adityagupta1089/Bike-Rental-App

View on GitHub

Showing 13 of 13 total issues

Method run has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public void run(BikeRentalAppConfiguration configuration,
            Environment environment) {
        LOGGER.info("Starting the Bike Rental App");
        SessionFactory factory = hibernateBundle.getSessionFactory();
Severity: Minor
Found in src/main/java/com/csl456/bikerentalapp/BikeRentalApplication.java - About 1 hr to fix

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

    package com.csl456.bikerentalapp.resources;
    
    import com.csl456.bikerentalapp.core.Person;
    import com.csl456.bikerentalapp.core.UserRole;
    import com.csl456.bikerentalapp.db.PersonDAO;
    src/main/java/com/csl456/bikerentalapp/resources/LocationResource.java on lines 1..39

    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 66.

    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

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

    package com.csl456.bikerentalapp.resources;
    
    import com.csl456.bikerentalapp.core.Location;
    import com.csl456.bikerentalapp.core.UserRole;
    import com.csl456.bikerentalapp.db.LocationDAO;
    src/main/java/com/csl456/bikerentalapp/resources/PersonResource.java on lines 1..36

    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 66.

    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

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        public UserResource(UserDAO userDAO, SessionDAO sessionDAO,
                PersonDAO personDAO, SMTPServerDetails smtpServerDetails) {
            this.userDAO           = userDAO;
            this.sessionDAO        = sessionDAO;
            this.personDAO         = personDAO;
    src/main/java/com/csl456/bikerentalapp/core/Cycle.java on lines 41..46
    src/main/java/com/csl456/bikerentalapp/core/SMTPServerDetails.java on lines 10..16
    src/main/java/com/csl456/bikerentalapp/core/User.java on lines 36..41

    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 49.

    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

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        public User(String username, String password, UserRole role, int personId) {
            this.username = username;
            this.password = password;
            this.role     = role;
            this.personId = personId;
    Severity: Major
    Found in src/main/java/com/csl456/bikerentalapp/core/User.java and 3 other locations - About 40 mins to fix
    src/main/java/com/csl456/bikerentalapp/core/Cycle.java on lines 41..46
    src/main/java/com/csl456/bikerentalapp/core/SMTPServerDetails.java on lines 10..16
    src/main/java/com/csl456/bikerentalapp/resources/UserResource.java on lines 58..64

    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 49.

    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

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        public SMTPServerDetails(String host, int port, String username,
                String password) {
            this.host     = host;
            this.port     = port;
            this.username = username;
    src/main/java/com/csl456/bikerentalapp/core/Cycle.java on lines 41..46
    src/main/java/com/csl456/bikerentalapp/core/User.java on lines 36..41
    src/main/java/com/csl456/bikerentalapp/resources/UserResource.java on lines 58..64

    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 49.

    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

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        public Cycle(String brand, int locationId, int ownerId, int status) {
            this.brand      = brand;
            this.locationId = locationId;
            this.ownerId    = ownerId;
            this.status     = status;
    Severity: Major
    Found in src/main/java/com/csl456/bikerentalapp/core/Cycle.java and 3 other locations - About 40 mins to fix
    src/main/java/com/csl456/bikerentalapp/core/SMTPServerDetails.java on lines 10..16
    src/main/java/com/csl456/bikerentalapp/core/User.java on lines 36..41
    src/main/java/com/csl456/bikerentalapp/resources/UserResource.java on lines 58..64

    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 49.

    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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    package com.csl456.bikerentalapp.db;
    
    import com.csl456.bikerentalapp.core.Location;
    import io.dropwizard.hibernate.AbstractDAO;
    import org.hibernate.SessionFactory;
    Severity: Minor
    Found in src/main/java/com/csl456/bikerentalapp/db/LocationDAO.java and 2 other locations - About 40 mins to fix
    src/main/java/com/csl456/bikerentalapp/db/ComplaintDAO.java on lines 1..29
    src/main/java/com/csl456/bikerentalapp/db/PersonDAO.java on lines 1..29

    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 48.

    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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    package com.csl456.bikerentalapp.db;
    
    import com.csl456.bikerentalapp.core.Person;
    import io.dropwizard.hibernate.AbstractDAO;
    import org.hibernate.SessionFactory;
    Severity: Minor
    Found in src/main/java/com/csl456/bikerentalapp/db/PersonDAO.java and 2 other locations - About 40 mins to fix
    src/main/java/com/csl456/bikerentalapp/db/ComplaintDAO.java on lines 1..29
    src/main/java/com/csl456/bikerentalapp/db/LocationDAO.java on lines 1..29

    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 48.

    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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    package com.csl456.bikerentalapp.db;
    
    import com.csl456.bikerentalapp.core.Complaint;
    import io.dropwizard.hibernate.AbstractDAO;
    import org.hibernate.SessionFactory;
    Severity: Minor
    Found in src/main/java/com/csl456/bikerentalapp/db/ComplaintDAO.java and 2 other locations - About 40 mins to fix
    src/main/java/com/csl456/bikerentalapp/db/LocationDAO.java on lines 1..29
    src/main/java/com/csl456/bikerentalapp/db/PersonDAO.java on lines 1..29

    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 48.

    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

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

            Email email = EmailBuilder
                    .startingBlank()
                    .from("Bike Rental Admin", "noreply@bikerentalapp.com")
                    .to(person.getName(), person.getEmail())
                    .withSubject("Your Registration OTP")
    src/main/java/com/csl456/bikerentalapp/resources/UserResource.java on lines 129..135

    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 40.

    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

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

            Email email = EmailBuilder
                    .startingBlank()
                    .from("Bike Rental Admin", "noreply@bikerentalapp.com")
                    .to(person.getName(), person.getEmail())
                    .withSubject("Your Forgot Password OTP")
    src/main/java/com/csl456/bikerentalapp/resources/UserResource.java on lines 82..88

    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 40.

    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

    Method equals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public boolean equals(Object obj) {
            if (this == obj) return true;
            if (obj == null) return false;
            if (getClass() != obj.getClass()) return false;
    Severity: Minor
    Found in src/main/java/com/csl456/bikerentalapp/core/Person.java - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Severity
    Category
    Status
    Source
    Language