Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality for JSHint static analysis tool #60

Open
wants to merge 1 commit into
base: f24
Choose a base branch
from

Conversation

jankrom
Copy link

@jankrom jankrom commented Oct 24, 2024

Tool: JSHint

Installed JSHint through npm, which added this to the package.json file. I tested and used the tool by running it on CLI with jshint <path>. JSHint is a static analysis tool that catches suspicious usage that can cause problems in code such as syntax, implicit type conversion, global variable leaking, and more, was designed to be reduce friction of development in javascript.

The following screenshot is from running jshint src/
Screenshot 2024-10-23 at 9 55 21 PM

It does not include all the errors as there are 26249 errors in src folder but gives an idea into what types of errors the tool catches and how it is utilized.

Questions

What types of problems are you hoping your tooling will catch? What types of problems does this particular tool catch?

  • It catches suspicious usage that can cause problems in the code. This is things such syntax mistakes, implicit type conversion, leaking global variables, typos, potential bugs
  • It helpful for catching JS specific things such as ES5 and ES6 compatibility issues or bugs like == vs ====

What types of customization are possible or necessary?

  • Can run as CLI tool or JS module
  • Can set custom rules such as environment specific settings, how strict it is, what rules to follow such as allowing or not allowing undefined variables, what code style rules to follow, which errors or files to ignore, can define global variables to decrease false positives

How can/should this tool be integrated into a development process?

  • Can be used as an extension in VSCode and also other editors
  • Can be setup in CI pipeline
  • Can be used in CLI
  • Can be included in build tools such as Webpack

Are there many false positives? False negatives? True positive reports about things you don’t care about?

  • False positives: when using less conventional style that is still correct and global variables
  • False negatives: doesn’t perform deep analysis of code so can not detect program correctness, memory leaks, or how fast it is
  • True positives that we don’t care about: it does not have context to things outside of file so sometimes it will say things are not defined when in fact they are, which can lead to a lot of noise in errors and confusion

@jankrom jankrom added the enhancement New feature or request label Oct 24, 2024
@jankrom jankrom added this to the CI/CD milestone Oct 24, 2024
@jankrom jankrom self-assigned this Oct 24, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 11491231747

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 82.689%

Totals Coverage Status
Change from base Build 11447829284: 0.0%
Covered Lines: 22344
Relevant Lines: 25602

💛 - Coveralls

Copy link

@rosyyang224 rosyyang224 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I like how you noted the maintainers in your json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants