Files
codeql/javascript/ql/src/LanguageFeatures/WrongExtensionJSON.ql
Max Schaefer a803120414 Lower precision for a number of queries.
These queries are currently run by default, but don't have their results displayed.

Looking through results on LGTM.com, they are either false positives (e.g., `BitwiseSignCheck` which flags many perfectly harmless operations and `CompareIdenticalValues` which mostly flags NaN checks) or harmless results that developers are unlikely to care about (e.g., `EmptyArrayInit` or `MisspelledIdentifier`).

With this PR, the only queries that are still run but not displayed are security queries, where different considerations may apply.
2020-05-19 13:43:17 +01:00

20 lines
502 B
Plaintext

/**
* @name JSON in JavaScript file
* @description Storing JSON in files with extension 'js' or 'jsx' is error-prone.
* @kind problem
* @problem.severity recommendation
* @id js/json-in-javascript-file
* @tags maintainability
* language-features
* @precision low
*/
import javascript
from JSONValue v, File f
where
f = v.getFile() and
f.getExtension().regexpMatch("(?i)jsx?") and
not exists(v.getParent())
select v, "JSON data in file with extension '" + f.getExtension() + "'."