GithubHelp home page GithubHelp logo

kffl / bsdetector-server Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 142 KB

BSDetector server - JavaScript static code analysis tool

Home Page: https://bsdetector.netlify.com

C# 100.00%
code-smells good-practices static-code-analysis

bsdetector-server's People

Contributors

baton96 avatar kffl avatar rochusqwerty avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

bsdetector-server's Issues

"Excessively short identifiers" smell

  • Smell is based on traversing AST.
  • Smell is detected when the number of characters in the identifier is less than 3.
  • Smell is not detected when the number of characters in the identifier is greater than or equal to 3.

Small switch statements smell

Switch statements should have at minimum 3 case clauses - instead it's better to use an if statement.

  • Smell is based on traversing AST.
  • Smell is detected when the number of case clauses in the switch statement is less than 3.
  • Smell is not detected when the number of case clauses in the switch statement is greater than or equal to 3.

Analysis statistics

Related frontend issue:

kffl/bsdetector-client#22

Description

Acceptance criteria

  • It should return number of: lines, repos, files analyzed and smells detected
  • It should not require additional DB setup
  • It should be able to initialize empty database

"Excessively long identifiers" smell

  • Smell is based on traversing AST.
  • Smell is detected when the number of characters in the identifier is greater than 30.
  • Smell is not detected when the number of characters in the identifier is less than or equal to 30.

Uploading multiple files for analysis at once

As of now, the app allows users to either paste the code for analysis or select a single file for upload. The latter should be extended to support uploading and analyzing multiple files at once.

  • The app should allow users to analyze multiple files at once
  • Maximum number of files uploaded for analysis should be 10

"Long chaining of functions with the dot operator" detection

  • Smell is based on traversing AST.
  • Smell is detected when the number of functions for a chain with the dot operator is greater than 6.
  • Smell is not detected when the number of functions for a chain with the dot operator is less than or equal to 6.

GitHub OAuth login and private repo analysis

  • Add social login via GitHub OAuth
  • Allow users to choose private GitHub repo for analysis
  • Session id/token shall not be saved in browsers history upon successful auth via GitHub, after user is redirected to backend service and his access code is traded for an access token - secure redirection back to frontend SPA.

Basic RESTful API

  • It should read JS code from textbox
  • It should read JS code from attached file

Backend testing

Related frontend issue:

none

Description

Implement backend tests.

Acceptance criteria

  • At least 2/3 of smells shall have tests set up
  • If mocking AST nodes turns out to be too time consuming, these can alternatively be implemented as integration tests expecting a detection of defined smells in sample JS code.

Fetch github public repo

Fetch a public github repo for analysis via download link.

  • App will search the specified public GH repo for all js files and analyze them
  • App will not analyze files larger than 1MB
  • App will not analyze more than 50 js files at once
  • App will not analyze .min.js files, bundled js files and other repo junk

"Too many parameters" detection

  • Smells are based on traversing AST.
  • First smell is detected when the number of parameters for a regular function is greater than 5.
  • First smell is not detected when the number of parameters for a regular function is less than or equal to 5.
  • Second smell is detected when the number of parameters for an arrow function is greater than 4.
  • Second smell is not detected when the number of parameters for an arrow function is less than or equal to 4.

Too many consecutive brackets

Related frontend issue:

TBD

Description

Add detection of 'Too many consecutive brackets' code smell. It occurs if there are more than three subsequent brackets in one line of code.

Acceptance criteria

  • It should detect more than 3 consecutive brackets (either ( or {)
  • It should not highlight more than one occurrence per line of code

Analyze entire project, not separate files

Add an option to analyze entire uploaded repo and parse JS files differently depending on whether these are scripts or modules.

  • Allow repo upload in zip
  • Analyze each js file in repo

"Long scope chaining" detection

  • Smell is based on traversing AST.
  • Smell is detected when the level of nested functions is greater than 3.
  • Smell is not detected when the level of nested functions is less than or equal to 3.

"Excessively long line of code" detection

  • Smell is based on traversing AST.
  • Smell is detected when the number of chars per line is greater than 140.
  • Smell is not detected when the number of chars per line is less than or equal to 140.

"Long method" smell

  • Smell is detected when the number of method code lines is greater than 40.
  • Smell is not detected when the number of method code lines is less than or equal to 40.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.