HarvestHub/GardenHub

View on GitHub

Showing 74 of 74 total issues

File models.py has 402 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from django.db import models
from django.db.models import Q
from django.core.mail import send_mail
from django.conf import settings
from django.contrib.auth import get_user_model
Severity: Minor
Found in gardenhub/models.py - About 5 hrs to fix

    File views.py has 393 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from django.db.models import Q
    from django.http import HttpResponseRedirect, JsonResponse
    from django.contrib import messages
    from django.contrib.auth import get_user_model, login
    from django.contrib.auth.views import (
    Severity: Minor
    Found in gardenhub/views.py - About 5 hrs to fix

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

      class GardenerFactory(ActiveUserFactory):
          @factory.post_generation
          def plots(self, create, extracted, **kwargs):
              if extracted:
                  # Set to plots if provided
      Severity: Major
      Found in gardenhub/factories.py and 2 other locations - About 2 hrs to fix
      gardenhub/factories.py on lines 83..92
      gardenhub/factories.py on lines 95..104

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

      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

      class GardenManagerFactory(ActiveUserFactory):
          @factory.post_generation
          def gardens(self, create, extracted, **kwargs):
              if extracted:
                  # Set to gardens if provided
      Severity: Major
      Found in gardenhub/factories.py and 2 other locations - About 2 hrs to fix
      gardenhub/factories.py on lines 71..80
      gardenhub/factories.py on lines 95..104

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

      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

      @register.simple_tag(takes_context=True)
      def plot_user_orders(context, plot):
          """
          Return the user's Orders for the given Plot.
          """
      Severity: Major
      Found in gardenhub/templatetags/gardenhub.py and 1 other location - About 2 hrs to fix
      gardenhub/templatetags/gardenhub.py on lines 6..13

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

      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

      class PickerFactory(ActiveUserFactory):
          @factory.post_generation
          def picker_gardens(self, create, extracted, **kwargs):
              if extracted:
                  # Set gardens if provided
      Severity: Major
      Found in gardenhub/factories.py and 2 other locations - About 2 hrs to fix
      gardenhub/factories.py on lines 71..80
      gardenhub/factories.py on lines 83..92

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

      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

      @register.simple_tag(takes_context=True)
      def garden_user_orders(context, garden):
          """
          Return the user's Orders for the given Garden.
          """
      Severity: Major
      Found in gardenhub/templatetags/gardenhub.py and 1 other location - About 2 hrs to fix
      gardenhub/templatetags/gardenhub.py on lines 16..23

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

      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

              for inquirer in pick.inquirers():
                  inquirer.email_user(
                      subject="Plot {} in {} has been picked!".format(
                          pick.plot.title, pick.plot.garden.title),
                      message=render_to_string(
      Severity: Major
      Found in gardenhub/views.py and 1 other location - About 1 hr to fix
      gardenhub/views.py on lines 144..151

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

      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

              for picker in pickers:
                  picker.email_user(
                      subject="New order on plot {} in {}".format(
                          order.plot.title, order.plot.garden.title),
                      message=render_to_string(
      Severity: Major
      Found in gardenhub/views.py and 1 other location - About 1 hr to fix
      gardenhub/views.py on lines 196..203

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

      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

      Function form_valid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def form_valid(self, form):
              user = self.request.user
              data = form.cleaned_data
      
              # Set user's name
      Severity: Minor
      Found in gardenhub/views.py - About 45 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

      Function email_user has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def email_user(self, subject, message, from_email=None, **kwargs):
      Severity: Minor
      Found in gardenhub/models.py - About 35 mins to fix

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

        class GardenForm(forms.ModelForm):
            manager_emails = MultipleEmailField(required=False)
        
            class Meta:
                model = Garden
        Severity: Minor
        Found in gardenhub/forms.py and 1 other location - About 35 mins to fix
        gardenhub/forms.py on lines 59..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 33.

        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

        class PlotForm(forms.ModelForm):
            gardener_emails = MultipleEmailField(required=False)
        
            class Meta:
                model = Plot
        Severity: Minor
        Found in gardenhub/forms.py and 1 other location - About 35 mins to fix
        gardenhub/forms.py on lines 67..72

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

        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

        Line length
        Open

        Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
        Severity: Info
        Found in CODE_OF_CONDUCT.md by markdownlint

        MD013 - Line length

        Tags: line_length

        Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

        This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

        This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

        You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

        Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

        Line length
        Open

        Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at harvesthubphilly@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
        Severity: Info
        Found in CODE_OF_CONDUCT.md by markdownlint

        MD013 - Line length

        Tags: line_length

        Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

        This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

        This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

        You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

        Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

        Line length
        Open

        After Docker is installed, you'll want to add your user to the docker group so you don't need `sudo` to run Docker commands.
        Severity: Info
        Found in README.md by markdownlint

        MD013 - Line length

        Tags: line_length

        Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

        This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

        This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

        You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

        Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

        Block comment should start with '# '
        Open

        #html_additional_pages = {}
        Severity: Minor
        Found in docs/conf.py by pep8

        Separate inline comments by at least two spaces.

        An inline comment is a comment on the same line as a statement.
        Inline comments should be separated by at least two spaces from the
        statement. They should start with a # and a single space.
        
        Each line of a block comment starts with a # and a single space
        (unless it is indented text inside the comment).
        
        Okay: x = x + 1  # Increment x
        Okay: x = x + 1    # Increment x
        Okay: # Block comment
        E261: x = x + 1 # Increment x
        E262: x = x + 1  #Increment x
        E262: x = x + 1  #  Increment x
        E265: #Block comment
        E266: ### Block comment

        Line length
        Open

        Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
        Severity: Info
        Found in CODE_OF_CONDUCT.md by markdownlint

        MD013 - Line length

        Tags: line_length

        Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

        This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

        This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

        You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

        Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

        Line length
        Open

        GardenHub is building technology to enable gardeners to collaborate and act upon what's growing, ripening, and available for harvest in their gardens. Using this information, GardenHub notifies gardeners, local charities, restaurants, and other stakeholders of the availability of this food.
        Severity: Info
        Found in README.md by markdownlint

        MD013 - Line length

        Tags: line_length

        Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

        This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

        This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

        You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

        Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

        Line length
        Open

        You will also need [Docker Compose](https://docs.docker.com/compose/install/#install-compose) for local development. Check if you already have it by typing `docker-compose version`.
        Severity: Info
        Found in README.md by markdownlint

        MD013 - Line length

        Tags: line_length

        Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

        This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

        This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

        You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

        Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

        Severity
        Category
        Status
        Source
        Language