question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule IDs are magic numbers

See original GitHub issue

I think the rule IDs are pretty cryptic:

{
  "comma-dangle": [2, "never"],
  "no-console": 0,
  "curly": [1, "multi-line"]
}

What about we use some mnemonic strings instead?

{
  "comma-dangle": ["require", "never"],
  "no-console": "ignore",
  "curly": ["favor", "multi-line"]
}

Where require generates errors, favor generates warnings, and ignore turns the rule off.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:21 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
lo1tumacommented, May 29, 2015

I agree that those magic numbers are a bad thing, especially for a code quality tool.

I’m not sure that your proposal really improves something because the enums aren’t very meaningful without context.

I would prefer something like this:

any-rule: { severity: "error",  options: []} 
any-rule: { severity: "warning", options: []} 
any-rule: { severity: "off", options: []} 

any-rule: "error" 
any-rule: "warning" 
any-rule: "off" 
0reactions
nzakascommented, May 29, 2015

I don’t want two ways of doing configuration, that increases complexity for very little gain.

@lo1tuma if you want to think about some incremental improvements for 2.0.0, add that to the wish list.

For now, we aren’t going to make any changes. The documentation is pretty clear about these numbers, we should keep pointing people to it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Magic number (programming) - Wikipedia
In computer programming, a magic number is any of the following: A unique value with unexplained meaning or multiple occurrences which could (preferably)...
Read more >
What is a magic number, and why is it bad? - Stack Overflow
A magic number is a direct usage of a number in the code. ... is that you're reusing a space (that of signed...
Read more >
Are magic numbers always magic in Programming?
However, we shouldn't blindly follow disallow magic number rule! We can argue that not all numbers are magic. For example, HTTP status codes...
Read more >
Requirements numbering - No Magic Documentation
The default Requirement IDs in modeling tool are hierarchical numbers: 1, 1.1, 1.1.1, etc. As example, see the following figure. Requirements numbering. The ......
Read more >
What is a magic number? - IBM
ANSWER: A magic number is a numeric or string constant that indicates the file type. This number is in the first 512 bytes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found