You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.
The bug is about "magic numbers" inside of strings written in backticks ( `)
SonarTS version: 1.8
Node.js version: 10.11.0
TypeScript version: 3.1.6
Reproducer
public static formatDate(dateString: string): string {
let partials = dateString.split(".")
partials = partials.map((item: string) => {
return item.length < Constants.DATE_DIGITS ? `0${item}` : item // this 0 is detected as a magic number, but on the one side it is a 0 which should be allowed anyway and on the other side this is a string which should never be a magic "number"...
})
return `${partials[Constants.DATE_DAY]}.${partials[Constants.DATE_MONTH]}.${partials[Constants.DATE_YEAR]}`
}
Expected behavior
Strings should not be checked for containing "magic numbers"
The text was updated successfully, but these errors were encountered:
I can't reproduce with your code snippet. Are you sure this issue is coming from SonarTS analyzer? If that's the case then small project reproducing your problem will help.
Also you could add issue screenshot.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I want to report a bug.
The bug is about "magic numbers" inside of strings written in backticks ( `)
SonarTS version: 1.8
Node.js version: 10.11.0
TypeScript version: 3.1.6
Reproducer
Expected behavior
Strings should not be checked for containing "magic numbers"
The text was updated successfully, but these errors were encountered: