Giter Site home page Giter Site logo

lentil's People

Contributors

clueless-skywatcher avatar

Watchers

 avatar

lentil's Issues

N0002: Implement check for underscored names in classes, fields and variables

This checker will check for every instance where underscores are being used. This will check

  • Class names
  • Variable names

Constants, i.e. final static fields of a class, and enum fields will be ignored here.

int abc_def = 5; // Violation
int abcDef = 5; // OK
class XYZ_Name // Violation
class XYZName // OK
final static int ABC_DEF = 5 // OK
enum AbcDef { FIELD_1, // OK FIELD_2 // OK }

Checker: BP0001 - Check whether a Boolean-returning function is returning null

Category: Bad Practice (BP)
Issue Code: BP0001

Description: Checks whether methods in the code that return booleans are returning null instead.

Examples:

public class BooleanReturnNullExample {
    public boolean abcd(){
        System.out.println("Not okay");
        if (1 == 1){
            return true;
        } else {
            return null;
        }
    }

    public Boolean abcd2(){
        System.out.println("Not okay");
        if (1 == 2){
            return true;
        } else {
            return null;
        }
    }

    public boolean defg(){
        System.out.println("Okay");
        return true;
    }
}

This code will cause issues to be raised at lines 7 and 16.

Checker: A0001 - Check whether annotations are on different lines

Check code: A0001

Check description:

Whenever a variable, class or method is declared with an annotation, check whether the annotations not on the same line as their targets.

Example:

import javax.annotation.Nullable;

@SuppressWarnings(value = "abcd") // OK
public class AnnotationExample {
    @Deprecated public void abcd(){ // Violation
        @Nullable // OK
        String anno;
        
        @Nullable int abc; // Violation
    }

    @Deprecated // OK
    public void abcd2(@Nullable String xyz){ // Still ok since it is a param annotation
    }
}

@SuppressWarnings(value = "abcd") class ABCD {

}

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.