Giter Club home page Giter Club logo

trolit / patchron Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 1.64 MB

performs initial pull request code review ๐Ÿ•ต๏ธ. Inteded to faster code reviews, not substitute human one

Home Page: https://github.com/trolit/patchron-test/pulls

License: ISC License

Dockerfile 0.18% JavaScript 99.53% Shell 0.30%
automated-code-review code-review probot-apps github-bot node-app probot pull-request-review review-bot code-review-bot pr-review

patchron's People

Contributors

dependabot[bot] avatar renovate[bot] avatar trolit avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

patchron's Issues

!rereview command

Add option that restricted number of users (or PR owner) can call !rereview command to re-run bot review

Array Shortcut Rule

var awesomeBands = new Array();
awesomeBands[0] = 'Bad Religion';
awesomeBands[1] = 'Dropkick Murphys';
awesomeBands[2] = 'Flogging Molly';
awesomeBands[3] = 'Red Hot Chili Peppers';
awesomeBands[4] = 'Pornophonique';
var awesomeBands = [
  'Bad Religion',
  'Dropkick Murphys',
  'Flogging Molly',
  'Red Hot Chili Peppers',
];

Predefined Filename Rule

configure directories that would require specific file naming convention. For instance,

{
  path: 'backend/controllers',
  filename: /.*Controller.js/
}

Force Object Literal Rule

var cow = new Object();
cow.colour = 'brown';
cow.commonQuestion = 'What now?';
cow.moo = function(){
  console.log('moo');
}
cow.feet = 4;
cow.accordingToLarson = 'will take over the world';

against

var cow = {
  colour:'brown',
  commonQuestion:'What now?',
  moo:function(){
    console.log('moo);
  },
  feet:4,
  accordingToLarson:'will take over the world'
};

No Length Reading At Every Loop Iteration Rule

Loops can become very slow if you donโ€™t do them right. One of the most common mistake is to read the length attribute of an array at every iteration:

var names = ['George','Ringo','Paul','John'];
for(var i=0;i<names.length;i++){
  doSomeThingWith(names[i]);
}

This means that every time the loop runs, JavaScript needs to read the length of the array. You can avoid that by storing the length value in a different variable:

var names = ['George','Ringo','Paul','John'];
var all = names.length;
for(var i=0;i<all;i++){
  doSomeThingWith(names[i]);
}

No Shorthand Variables Rule

suggest minimum length for const/let/var variable names

// case1
const [ a, b ] = [ 1, 2 ];

// case1.1
const [ a, b, c, d, e, f ] = [ 
   1,
   2,
   3,
   4,
   ...
]

// case2
const { a, b } = { a: 1, b: 2 };

// case3
const a = 1;
const b = 2;

// case4
const a = 1,
      b = 2;

Value Comparision Style Rule (Patch Version)

Implement rule that allows to set how comparision statements should be expressed

Longhand

if (isValid === true) {
 // do something ...
}

if (isValid === false) {
 // do something ...
}

Shorthand

if (isValid) {
 // do something ...
}

if (!isValid) {
 // do something ...
}

PS: more details about complications in rule's documentation

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm pino-multi-stream Unavailable

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Update Probot (major) (@probot/adapter-github-actions, probot)
  • Update utilities to v3 (major) (cron, node-fetch)
  • Update dev dependencies (nock, nodemon, smee-client)
  • Update dev dependencies (major) (nodemon, smee-client)
  • Update actions/checkout action to v4
  • Update docker/login-action action to v3
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
Dockerfile
github-actions
.github/workflows/publish.yml
  • actions/checkout v3
  • docker/login-action v2
.github/workflows/test.yml
  • actions/checkout v3
npm
package.json
  • @probot/adapter-github-actions 3.1.3
  • cron 2.1.0
  • dayjs 1.11.7
  • dedent-js 1.0.1
  • dotenv 16.0.3
  • dotenv-parse-variables 2.0.0
  • http-status-codes 2.2.0
  • js-base64 3.7.3
  • lodash 4.17.21
  • module-alias 2.2.2
  • node-fetch ^2.6.7
  • pino-multi-stream 6.0.0
  • pino-tee 0.3.0
  • probot 12.2.8
  • nock 13.2.9
  • nodemon 2.0.20
  • smee-client 1.2.3

  • Check this box to trigger a request for Renovate to run again on this repository

Single Line Block Rule

Implement rule that allows to set pattern for conditional statements that include only single line

if (...)  // do something...

if (...) 
   // do something...
   
if (...) { 
   // do something...
}
do
    // something
while ();

do {
    // something
}
while ();

do 
{
    // something
}
while ();

Simple Short If Rule

Case 1

from:

return this.item?.total ? format(this.item.total) : 0;

to:

return format(this.item?.total || 0);

Case 2

from:

var direction;
if(x > 100){
  direction = 1;
} else {
  direction = -1;
}

to:

var direction = (x > 100) ? 1 : -1;

Case 3

from:

if(v){
  var x = v;
} else {
  var x = 10;
}

to:

var x = v || 10;

No Raw Indexing Rule

try to implement rule that enforces to reference element from array via index only once.

var f = document.getElementById('mainform');
var inputs = f.getElementsByTagName('input');

// wrong
for(var i=0,j=inputs.length;i<j;i++){
  if(inputs[i].className === 'mandatory' &&
     inputs[i].value === ''){
    inputs[i].style.borderColor = '#f00';
    inputs[i].style.borderStyle = 'solid';
    inputs[i].style.borderWidth = '1px';
  }
}

// correct
for(var i=0,j=inputs.length;i<j;i++){
  const input = inputs[i];

  if(input.className === 'mandatory' &&
    input.value === ''){
    input.style.borderColor = '#f00';
    input.style.borderStyle = 'solid';
    input.style.borderWidth = '1px';
  }
}

โš ๏ธ
Patch limited information problem :(

MarkedCommentsRule for HTML

Extend MarkedComments Rule and implement rule for HTML

or

rework MarkedCommentsRule to accept comment blocks

Length Initialized Before Loop Rule

Loops can become very slow if you donโ€™t do them right. One of the most common mistake is to read the length attribute of an array at every iteration:

var names = ['George','Ringo','Paul','John'];
for(var i=0;i<names.length;i++){
  doSomeThingWith(names[i]);
}

This means that every time the loop runs, JavaScript needs to read the length of the array. You can avoid that by storing the length value in a different variable:

var names = ['George','Ringo','Paul','John'];
var all = names.length;
for(var i=0;i<all;i++){
  doSomeThingWith(names[i]);
}

Load bot configuration by passing URL to file

env should include property

URL_TO_BOT_CONFIGURATION=

when provided, bot on init fetches config, parses it and uses as active one. If URL is not provided, default (current) config is used.

Misspelled Name Rule

Use e.g. words collection to suggest words that were potentially misspelled?

โš ๏ธ

  • Would require ability to store words that should be ignored (via local file or DB)
  • What are the odds for custom names?

Logical Operator Style

Aborted due to insufficient data to determine "extended" mode within patches
e.g. if (something) to comment it and suggest if (something === true) instead.

Instead of Logical Operator Style only simple mode rule will be introduced.

but there is window for that in later version ๐Ÿค”

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.