moskirathe / JScent

A static progam analysis and visualization tool that detects code smells in a given JS codebase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JScent

Video: https://youtu.be/_FAUq98qELY

JScent is a program analyzer that detects code smells. Code smells are potential issues with source code that can correspond to a deeper problem in the program. For example, JScent can detect issues such as long methods, too many comments, feature envy, message chains, dead code and more. JScent produces a report that summarizes all the code smells found in a concise and usable way - easily accessible in the console. The JScent analysis can be classified both as a value-agnostic static analysis and a meta-properties analysis, as some code smells lean more toward syntax and others more toward semantics and high-level Software Engineering principles.

Sample Report:

104295230_855982801476736_6366856029886815010_n

JScent is aimed at developers and teams who are trying to build code that is maintainable, extensible, and well structured. The reports generated are not intended to be prescriptive but rather point out areas that may be cause for concern as a project grows in size and scope.

JScent is structured in a way that it is easily extensible to add new code smells in the future. Next steps for the team include adding more nuanced, difficult to spot smells to the analysis report.

Instructions

Put all the JS files you want to analyze in the /input folder, and run main.js to start.

Example code smells detectable by JScent

  • Long message chain - In code you see a series of calls resembling a->b()->c()->d()
  • Feature envy - A method accesses the data of another object more than its own data.
  • Long parameter list - A method with more than 3 parameters
  • Large objects - A class/object that is doing too much
  • Dead code - A variable, parameter, field, method or class is no longer used (usually because it is obsolete).
  • Long Methods - A method contains too many lines of code
  • Switch statement - A switch statement with too many cases
  • Method comments - A method is filled with explanatory comments

Credit and References

About

A static progam analysis and visualization tool that detects code smells in a given JS codebase


Languages

Language:JavaScript 100.0%