SeasonedSoftware/croods-rails

View on GitHub

Showing 13 of 19 total issues

Function render has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    return (
      <footer className="nav-footer" id="footer">
        <section className="sitemap">
          <a href={this.props.config.baseUrl} className="nav-home">
Severity: Major
Found in docs/website/core/Footer.js - About 3 hrs to fix

    Function Help has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Help(props) {
      const {config: siteConfig, language = ''} = props;
      const {baseUrl, docsUrl} = siteConfig;
      const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
      const langPart = `${language ? `${language}/` : ''}`;
    Severity: Minor
    Found in docs/website/pages/en/help.js - About 1 hr to fix

      Function render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const {config: siteConfig} = this.props;
          if ((siteConfig.users || []).length === 0) {
            return null;
          }
      Severity: Minor
      Found in docs/website/pages/en/users.js - About 1 hr to fix

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

                    <a
                      className="github-button"
                      href={this.props.config.repoUrl}
                      data-icon="octicon-star"
                      data-count-href="/facebook/docusaurus/stargazers"
        Severity: Minor
        Found in docs/website/core/Footer.js and 1 other location - About 55 mins to fix
        docs/website/core/Footer.js on lines 94..102

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

        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

                        <div
                          className="fb-like"
                          data-href={this.props.config.url}
                          data-colorscheme="dark"
                          data-layout="standard"
        Severity: Minor
        Found in docs/website/core/Footer.js and 1 other location - About 55 mins to fix
        docs/website/core/Footer.js on lines 73..82

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

        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 reflection_path has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def reflection_path(scope, target, path = [])
                return path if scope_is_the_owner?(scope, target)
        
                associations = scope.reflect_on_all_associations(:belongs_to)
        
        
        Severity: Minor
        Found in lib/croods/policy/scope.rb - About 55 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

        Method reflection_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def reflection_user(record)
              return unless record
        
              return record.user if user_is_the_owner?(record)
        
        
        Severity: Minor
        Found in lib/croods/policy.rb - About 35 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

        Method add_model_authentication has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_model_authentication(*options)
                extend_model do
                  before_create do
                    self.uid = email unless uid.present?
                  end
        Severity: Minor
        Found in lib/croods/resource/authentication.rb - About 35 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

        Method public_actions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def public_actions(*names)
                return unless names
        
                names = [names] if names.is_a?(Symbol)
        
        
        Severity: Minor
        Found in lib/croods/resource/authorization.rb - About 35 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

        Method apply_filters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def apply_filters(scope, params)
                filters.each do |attribute|
                  attribute.name = "#{attribute.name}_id" unless model.has_attribute?(attribute.name)
        
                  value = params[attribute.name]
        Severity: Minor
        Found in lib/croods/resource/filters.rb - About 35 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

        Method schema has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                  def schema(resource, request: false)
                    required = []
        
                    properties = resource.response_attributes
                    properties = resource.request_attributes if request
        Severity: Minor
        Found in lib/croods/resource/json_schema/required.rb - About 35 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

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

            def authorize_associations
              return true if skip_associations_authorization?
              return false if other_tenant_user?
        
              associations = list_associations(member)
        Severity: Minor
        Found in lib/croods/policy.rb - 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

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

            def authorize_action(action)
              return true if action.public
        
              return false unless authorize_associations
        
        
        Severity: Minor
        Found in lib/croods/policy.rb - 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