beavyHQ/beavy

View on GitHub

Showing 32 of 702 total issues

File fetching_test.py has 641 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# flake8: noqa
import pytest
from urllib.parse import urlparse
from .fetching import extractor

Severity: Major
Found in beavy_modules/url_extractor/lib/fetching_test.py - About 1 day to fix

    Function exports has 171 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (options) {
      var entry = {
        'main': ['./beavy/jsbeavy/main.jsx']
      }
      var loaders = {
    Severity: Major
    Found in .infrastructure/webpack/make-webpack-config.js - About 6 hrs to fix

      Function exports has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function (options) {
        var entry = {
          'main': ['./beavy/jsbeavy/main.jsx']
        }
        var loaders = {
      Severity: Minor
      Found in .infrastructure/webpack/make-webpack-config.js - About 2 hrs 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 _matches has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def _matches(data, **kwargs):
          for key, match in kwargs.items():
              try:
                  given_value = data[key]
              except KeyError:
      Severity: Minor
      Found in beavy_modules/url_extractor/lib/fetching.py - About 2 hrs 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 fallbackRender has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def fallbackRender(template, key=None):
      
          def wrapper(fn):
              @wraps(fn)
              def decorated_view(*args, **kwargs):
      Severity: Minor
      Found in beavy/utils/__init__.py - About 2 hrs 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 after_scenario has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def after_scenario(context, scenario):
      
          if getattr(context, "browser", None):
              has_warnings = False
              for entry in context.browser.driver.get_log('browser'):
      Severity: Minor
      Found in beavy/testing/environment.py - About 2 hrs 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 format_jsonapi_result has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function format_jsonapi_result (input, key) {
        const entitiesMap = {}
        const result = {}
        const output = { entities: entitiesMap }
        const addToMap = (x) => {
      Severity: Minor
      Found in beavy/jsbeavy/middleware/format_jsonapi_result.jsx - About 1 hr 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 format_jsonapi_result has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function format_jsonapi_result (input, key) {
        const entitiesMap = {}
        const result = {}
        const output = { entities: entitiesMap }
        const addToMap = (x) => {
      Severity: Minor
      Found in beavy/jsbeavy/middleware/format_jsonapi_result.jsx - About 1 hr to fix

        Function getRoutes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          getRoutes () {
            const routes_by_path = {}
            const remapRoutes = (routes, path = '') => {
              for (let i = routes.length - 1; i >= 0; i--) {
                addRoute(routes[i], path)
        Severity: Minor
        Found in beavy/jsbeavy/config/root.jsx - About 1 hr 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 api_only has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def api_only(fn):
            @wraps(fn)
            def wrapped(*args, **kwargs):
                accepted = set(request.accept_mimetypes.values())
                explicit = not(not request.args.get("json", False))
        Severity: Minor
        Found in beavy/utils/__init__.py - About 1 hr 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 __call__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def __call__(self, soup, data, url=None):
                if data.get("description", False):
                    return
        
                for query in [dict(id="content"),
        Severity: Minor
        Found in beavy_modules/url_extractor/lib/fetching.py - About 1 hr 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 configureStore has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function configureStore (initialState) {
          let middlewares = getExtensions('storeMiddlewares')
          if (__DEBUG__) {
            // we concat to make sure we aren't messing with
            // with the extensions list itself but create a copy
        Severity: Minor
        Found in beavy/jsbeavy/stores/index.jsx - About 1 hr to fix

          Function __eq__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def __eq__(self, other):
                  url = urlparse(other)
          
                  for p in ("scheme", "netloc", "path", "hostname", "port",
                            "username", "password", "params"):
          Severity: Minor
          Found in beavy_modules/url_extractor/lib/fetching_test.py - About 1 hr 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 __call__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def __call__(self, soup, data, url=None):
                  if not _matches(data, type="article"):
                      return
          
                  if not data.get("copyright", False):
          Severity: Minor
          Found in beavy_modules/url_extractor/lib/fetching.py - About 1 hr 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 paginate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function paginate ({ types, mapActionToKey }) {
            if (!Array.isArray(types) || types.length !== 3) {
              throw new Error('Expected types to be an array of three elements.')
            }
            if (!types.every(t => typeof t === 'string')) {
          Severity: Minor
          Found in beavy/jsbeavy/reducers/paginate.jsx - About 1 hr 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 __call__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def __call__(self, soup, data, url=None):
                  if not _matches(data,
                                  generator=lambda x: x.lower().startswith("mediawiki")
                                  ) or data.get("type", False):
                      return
          Severity: Minor
          Found in beavy_modules/url_extractor/lib/fetching.py - About 1 hr 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 getRoutes has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            getRoutes () {
              const routes_by_path = {}
              const remapRoutes = (routes, path = '') => {
                for (let i = routes.length - 1; i >= 0; i--) {
                  addRoute(routes[i], path)
          Severity: Minor
          Found in beavy/jsbeavy/config/root.jsx - About 1 hr to fix

            Function deep_map_translations_in has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def deep_map_translations_in(path, ignore={}):
                all_translations = {}
                for root, dirs, files in os.walk(path):
                    for name in files:
                        with open(os.path.join(root, name)) as f:
            Severity: Minor
            Found in .infrastructure/i18n/reformat-react-intl-json.py - About 1 hr 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 deepmerge has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def deepmerge(a, b):
                "merges b into a"
                for key in b:
                    if key in a:
                        if isinstance(a[key], dict) and isinstance(b[key], dict):
            Severity: Minor
            Found in beavy/utils/deepmerge.py - About 1 hr 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 make_env has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def make_env(app):
                # environment-based configuration loading
                env = Environments(app, var_name="BEAVY_ENV")
            
                env.from_yaml(os.path.join(BASE_DIR, 'config.yml'))
            Severity: Minor
            Found in beavy/app.py - About 1 hr 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