ljacqu/DependencyInjector

View on GitHub

Showing 12 of 12 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    @Override
    public Resolution<?> resolve(ResolutionContext context) {
        final Injector injector = context.getInjector();
        if (!areMocksRegistered) {
            registerAllMocks(injector);
injector/src/main/java/ch/jalu/injector/testing/extension/MockDependencyHandler.java on lines 33..54

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    @Override
    public Resolution<?> resolve(ResolutionContext context) {
        final Injector injector = context.getInjector();
        if (!areMocksRegistered) {
            registerAllMocks(injector);
injector/src/main/java/ch/jalu/injector/testing/runner/MockDependencyHandler.java on lines 34..55

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    @Override
    public Resolution<?> resolve(ResolutionContext context) {
        final Class<?> clazz = context.getIdentifier().getTypeAsClass();
        for (Annotation annotation : context.getIdentifier().getAnnotations()) {
            Object o = resolveByAnnotation(annotation.annotationType(), clazz);
injector/src/main/java/ch/jalu/injector/testing/runner/AnnotationResolver.java on lines 45..55

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 64.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    @Override
    public Resolution<?> resolve(ResolutionContext context) {
        final Class<?> clazz = context.getIdentifier().getTypeAsClass();
        for (Annotation annotation : context.getIdentifier().getAnnotations()) {
            Object o = resolveByAnnotation(annotation.annotationType(), clazz);
injector/src/main/java/ch/jalu/injector/testing/extension/AnnotationResolver.java on lines 42..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 64.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Missing a Javadoc comment.
Open

    public void evaluate() {

Checks for missing Javadoc comments for a method or constructor.The scope to verify is specified using the Scope class anddefaults to Scope.PUBLIC. To verify anotherscope, set property scope to a differentscope.

Javadoc is not required on a method that is tagged with the@Override annotation. However underJava 5 it is not possible to mark a method required for aninterface (this was corrected under Java 6). HenceCheckstyle supports using the convention of using a single{@inheritDoc} tag instead of all theother tags.

For getters and setters for the property allowMissingPropertyJavadoc,the methods must match exactly the structures below.

public void setNumber(final int number){mNumber = number;}public int getNumber(){return mNumber;}public boolean isSomething(){return false;}

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Variable 'providers' must be private and have accessor methods.
Open

    protected Map<Class<?>, ProviderBasedInstantiation<?>> providers = new HashMap<>();

Checks visibility of class members. Only static final, immutable or annotatedby specified annotation members may be public; other class members must be privateunless the property protectedAllowed or packageAllowed is set.

Public members are not flagged if the name matches the publicmember regular expression (contains "^serialVersionUID$" by default).

Note thatCheckstyle 2 used to include "^f[A-Z][a-zA-Z0-9]*$" in the defaultpattern to allow names used in container-managed persistence for Enterprise JavaBeans(EJB) 1.1 with the default settings. With EJB 2.0 it is no longer necessary to havepublic access for persistent fields, so the default has been changed.

Rationale: Enforce encapsulation.

Check also has options making it less strict:

ignoreAnnotationCanonicalNames - the list of annotations which ignore variablesin consideration. If user will provide short annotation name that type will match to anynamed the same type without consideration of package.

allowPublicFinalFields - which allows public final fields.

allowPublicImmutableFields - which allows immutable fields to be declared aspublic if defined in final class.

Field is known to be immutable if:

  • It's declared as final
  • Has either a primitive type or instance of class user defined to be immutable(such as String, ImmutableCollection from Guava and etc)

Classes known to be immutable are listed in immutableClassCanonicalNames by theircanonical names.

Property Rationale: Forcing all fields of class to have private modifier by default isgood in most cases, but in some cases it drawbacks in too much boilerplate get/set code.One of such cases are immutable classes.

Restriction: Check doesn't check if class is immutable, there's nochecking if accessory methods are missing and all fields are immutable, we only checkif current field is immutable or final. Under the flagallowPublicImmutableFields, the enclosing class must also be final, to encourageimmutability. Under the flag allowPublicFinalFields, the final modifier onthe enclosing class is optional.

Star imports are out of scope of this Check. So if one of type imported viastar import collides with user specified one by its short name -there won't be Check's violation.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Variable 'entries' must be private and have accessor methods.
Open

    protected Map<Class, WeakReference<Resolution>> entries = new ConcurrentHashMap<>();

Checks visibility of class members. Only static final, immutable or annotatedby specified annotation members may be public; other class members must be privateunless the property protectedAllowed or packageAllowed is set.

Public members are not flagged if the name matches the publicmember regular expression (contains "^serialVersionUID$" by default).

Note thatCheckstyle 2 used to include "^f[A-Z][a-zA-Z0-9]*$" in the defaultpattern to allow names used in container-managed persistence for Enterprise JavaBeans(EJB) 1.1 with the default settings. With EJB 2.0 it is no longer necessary to havepublic access for persistent fields, so the default has been changed.

Rationale: Enforce encapsulation.

Check also has options making it less strict:

ignoreAnnotationCanonicalNames - the list of annotations which ignore variablesin consideration. If user will provide short annotation name that type will match to anynamed the same type without consideration of package.

allowPublicFinalFields - which allows public final fields.

allowPublicImmutableFields - which allows immutable fields to be declared aspublic if defined in final class.

Field is known to be immutable if:

  • It's declared as final
  • Has either a primitive type or instance of class user defined to be immutable(such as String, ImmutableCollection from Guava and etc)

Classes known to be immutable are listed in immutableClassCanonicalNames by theircanonical names.

Property Rationale: Forcing all fields of class to have private modifier by default isgood in most cases, but in some cases it drawbacks in too much boilerplate get/set code.One of such cases are immutable classes.

Restriction: Check doesn't check if class is immutable, there's nochecking if accessory methods are missing and all fields are immutable, we only checkif current field is immutable or final. Under the flagallowPublicImmutableFields, the enclosing class must also be final, to encourageimmutability. Under the flag allowPublicFinalFields, the final modifier onthe enclosing class is optional.

Star imports are out of scope of this Check. So if one of type imported viastar import collides with user specified one by its short name -there won't be Check's violation.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Variable 'config' must be private and have accessor methods.
Open

    protected InjectorConfig config;

Checks visibility of class members. Only static final, immutable or annotatedby specified annotation members may be public; other class members must be privateunless the property protectedAllowed or packageAllowed is set.

Public members are not flagged if the name matches the publicmember regular expression (contains "^serialVersionUID$" by default).

Note thatCheckstyle 2 used to include "^f[A-Z][a-zA-Z0-9]*$" in the defaultpattern to allow names used in container-managed persistence for Enterprise JavaBeans(EJB) 1.1 with the default settings. With EJB 2.0 it is no longer necessary to havepublic access for persistent fields, so the default has been changed.

Rationale: Enforce encapsulation.

Check also has options making it less strict:

ignoreAnnotationCanonicalNames - the list of annotations which ignore variablesin consideration. If user will provide short annotation name that type will match to anynamed the same type without consideration of package.

allowPublicFinalFields - which allows public final fields.

allowPublicImmutableFields - which allows immutable fields to be declared aspublic if defined in final class.

Field is known to be immutable if:

  • It's declared as final
  • Has either a primitive type or instance of class user defined to be immutable(such as String, ImmutableCollection from Guava and etc)

Classes known to be immutable are listed in immutableClassCanonicalNames by theircanonical names.

Property Rationale: Forcing all fields of class to have private modifier by default isgood in most cases, but in some cases it drawbacks in too much boilerplate get/set code.One of such cases are immutable classes.

Restriction: Check doesn't check if class is immutable, there's nochecking if accessory methods are missing and all fields are immutable, we only checkif current field is immutable or final. Under the flagallowPublicImmutableFields, the enclosing class must also be final, to encourageimmutability. Under the flag allowPublicFinalFields, the final modifier onthe enclosing class is optional.

Star imports are out of scope of this Check. So if one of type imported viastar import collides with user specified one by its short name -there won't be Check's violation.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Comment matches to-do format 'TODO(?! #\d+:)|FIXME'.
Open

            // TODO: Revise signature -> creating a Set that will potentially be converted back to an array...

Checks for TODO: comments. Actuallyit is a genericregularexpression matcher on Java comments. To check for otherpatterns in Java comments, set the format property.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Missing a Javadoc comment.
Open

    public void testFinished() {

Checks for missing Javadoc comments for a method or constructor.The scope to verify is specified using the Scope class anddefaults to Scope.PUBLIC. To verify anotherscope, set property scope to a differentscope.

Javadoc is not required on a method that is tagged with the@Override annotation. However underJava 5 it is not possible to mark a method required for aninterface (this was corrected under Java 6). HenceCheckstyle supports using the convention of using a single{@inheritDoc} tag instead of all theother tags.

For getters and setters for the property allowMissingPropertyJavadoc,the methods must match exactly the structures below.

public void setNumber(final int number){mNumber = number;}public int getNumber(){return mNumber;}public boolean isSomething(){return false;}

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Missing a Javadoc comment.
Open

    protected void verifyIsClassPackageAllowed(Class<?> clazz) {

Checks for missing Javadoc comments for a method or constructor.The scope to verify is specified using the Scope class anddefaults to Scope.PUBLIC. To verify anotherscope, set property scope to a differentscope.

Javadoc is not required on a method that is tagged with the@Override annotation. However underJava 5 it is not possible to mark a method required for aninterface (this was corrected under Java 6). HenceCheckstyle supports using the convention of using a single{@inheritDoc} tag instead of all theother tags.

For getters and setters for the property allowMissingPropertyJavadoc,the methods must match exactly the structures below.

public void setNumber(final int number){mNumber = number;}public int getNumber(){return mNumber;}public boolean isSomething(){return false;}

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Variable 'objects' must be private and have accessor methods.
Open

    protected Map<Class<?>, Object> objects;

Checks visibility of class members. Only static final, immutable or annotatedby specified annotation members may be public; other class members must be privateunless the property protectedAllowed or packageAllowed is set.

Public members are not flagged if the name matches the publicmember regular expression (contains "^serialVersionUID$" by default).

Note thatCheckstyle 2 used to include "^f[A-Z][a-zA-Z0-9]*$" in the defaultpattern to allow names used in container-managed persistence for Enterprise JavaBeans(EJB) 1.1 with the default settings. With EJB 2.0 it is no longer necessary to havepublic access for persistent fields, so the default has been changed.

Rationale: Enforce encapsulation.

Check also has options making it less strict:

ignoreAnnotationCanonicalNames - the list of annotations which ignore variablesin consideration. If user will provide short annotation name that type will match to anynamed the same type without consideration of package.

allowPublicFinalFields - which allows public final fields.

allowPublicImmutableFields - which allows immutable fields to be declared aspublic if defined in final class.

Field is known to be immutable if:

  • It's declared as final
  • Has either a primitive type or instance of class user defined to be immutable(such as String, ImmutableCollection from Guava and etc)

Classes known to be immutable are listed in immutableClassCanonicalNames by theircanonical names.

Property Rationale: Forcing all fields of class to have private modifier by default isgood in most cases, but in some cases it drawbacks in too much boilerplate get/set code.One of such cases are immutable classes.

Restriction: Check doesn't check if class is immutable, there's nochecking if accessory methods are missing and all fields are immutable, we only checkif current field is immutable or final. Under the flagallowPublicImmutableFields, the enclosing class must also be final, to encourageimmutability. Under the flag allowPublicFinalFields, the final modifier onthe enclosing class is optional.

Star imports are out of scope of this Check. So if one of type imported viastar import collides with user specified one by its short name -there won't be Check's violation.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Severity
Category
Status
Source
Language