mirror of
https://github.com/github/codeql.git
synced 2026-01-12 14:10:21 +01:00
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.
20 lines
502 B
Plaintext
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() + "'."
|