Giter Club home page Giter Club logo

code_censor's Introduction

Code Censor

What is Code Censor?

Code Censor is a chrome extension to semi-automate PR (Pull Request) Reviews (specific to Drupal 8 and Github, for now) to ensure AN INFORMED DECISION is made by a human at every (seeming) violation of best practices.

The tool intends to make it easy for the reviewer to find violations in code through visual highlighting, along with prompts on how to remediate the code, and a way to quickly insert suggestions as a comment on the PR.

How do I enable Code Censor?

  1. Download and unzip the latest stable extension from https://github.com/apgokr/code_censor/releases
  2. In Chrome browser, go to chrome://extensions/.
  3. Enable Developer mode by ticking the checkbox in the upper-right corner.
  4. Click on the "Load unpacked extension..." button.
  5. Select the directory containing your unpacked extension.

What would Code Censor do on my Pull Request page?

  1. Highlight code violations for your review
  2. Allow inserting a remediation suggestion quickly as a Github comment by double clicking on the highlighted violation alt text

What type of reviews are performed?

Code Censor as of now is especially designed and developed for Drupal 8 projects hosted on github and flags issues related to

Security

Cases like raw twig filter, route access and param validations, proper usage of request data and similar have been successfully integrated in Code Censor.

Performance

Checks around Drupal module hooks, preprocessors, caching and entity loading strategies, PHP code practices that impacts the performance directly.

Best Practices

Drupal being a flexible, versatile CMS, follows certain best practices which are quite generic like inclusion of alt attribute with img tag, avoiding hard coded api URLs, apt php filenames, avoiding multiple returns and ensuring code readability.

Functionality

Checks like proper usage of event system, subscriber services, access validators, routing which are specific to Drupal have been addressed.

What does Code Censor NOT do?

Code Censor does not perform the job of code-sniffer tools like PHPCS. Like syntactical formatting or similar. It only addresses the issues that you watch for while doing code review on PRs. Like - hey, is this function too long? is dependency injection being used the right way here? is this a hard coded URL that should sit in config instead? are there too many returns in the function? should you use a $user object instead of $account object here? isn't Drupal::entityManager() method deprecated? is this image field markup missing alt and title?

How to create more tests?

Raise a Pull Request on this repository. Sample tests -

How can I add my own tests to Code Sniffer?

Once your test is created, you can modify your chrome extension locally to include new tests.

How can I contribute the tests to Code Sniffer?

You can raise a Pull Request against this repo.

code_censor's People

Contributors

gauravgoyal avatar purushotamrai avatar saitanay avatar vbouchet31 avatar

Watchers

 avatar

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.