Showing 176 of 177 total issues

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

    def matches(self, value):
        normval = self.normalize(value)
        if self.normalize(self.canonical_name) == normval:
            return True
        for alt in self.alternatives:
Severity: Minor
Found in data_capture/schedules/spreadsheet_utils.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 createButtonText has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  createButtonText() {
    const { selectedSchedule, queryBy } = this.props;
    let searchSummary;
    if (queryBy === QUERY_BY_SCHEDULE) {
      const allSchedsLabel = `${Object.keys(scheduleLabels).length} contract vehicles`;
Severity: Minor
Found in frontend/source/js/data-explorer/components/search-category.jsx - About 1 hr to fix

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

      render() {
        return (
          <div className="html-dropdown">
            <button
              type="button"
    Severity: Minor
    Found in frontend/source/js/data-explorer/components/search-category.jsx - About 1 hr to fix

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

                  if line[16] != '':
                      contract.contract_end = datetime.strptime(
                          line[16], '%m/%d/%Y').date()
      Severity: Major
      Found in contracts/loaders/region_10.py and 1 other location - About 1 hr to fix
      contracts/loaders/region_10.py on lines 31..33

      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

                  if line[15] != '':
                      contract.contract_start = datetime.strptime(
                          line[15], '%m/%d/%Y').date()
      Severity: Major
      Found in contracts/loaders/region_10.py and 1 other location - About 1 hr to fix
      contracts/loaders/region_10.py on lines 34..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 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

      Function makeInput has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const makeInput = (value, label) => {
          const id = value.replace(/ /g, '-').toLowerCase() || 'all-schedules';
          const makeLabel = (title) => {
            let scheduleLabel = title;
            let labelSuffix;
      Severity: Minor
      Found in frontend/source/js/data-explorer/components/schedule.jsx - About 1 hr to fix

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

          render() {
            const id = `${this.props.idPrefix}results-table`;
            const idHref = `#${id}`;
        
            return (
        Severity: Minor
        Found in frontend/source/js/data-explorer/components/results-table/index.jsx - About 1 hr to fix

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

                      <select
                        id={minId}
                        value={min}
                        name="min_experience"
                        onChange={onChange('min')}
          Severity: Major
          Found in frontend/source/js/data-explorer/components/experience.jsx and 1 other location - About 1 hr to fix
          frontend/source/js/data-explorer/components/experience.jsx on lines 117..125

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

          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

                      <select
                        id={maxId}
                        value={max}
                        name="max_experience"
                        onChange={onChange('max')}
          Severity: Major
          Found in frontend/source/js/data-explorer/components/experience.jsx and 1 other location - About 1 hr to fix
          frontend/source/js/data-explorer/components/experience.jsx on lines 104..112

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

          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 describe has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def describe(cursor, vocab, labor_category, min_years_experience,
          Severity: Major
          Found in data_capture/analysis/core.py - About 1 hr to fix

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

              render() {
                // Note that Chrome has issues with number input, so we're just
                // going to use a standard text field here. This is unfortunate for
                // mobile users, since they won't get a numeric keypad.
                //
            Severity: Minor
            Found in frontend/source/js/data-explorer/components/proposed-price.jsx - About 1 hr to fix

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

              export function gas(...args) {
                const origGas = window['gas'];
                if (typeof origGas === 'function') {
                  return origGas.apply(this, args);
                }
              Severity: Major
              Found in frontend/source/js/common/ga.js and 1 other location - About 1 hr to fix
              frontend/source/js/common/ga.js on lines 31..37

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

              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

              export function ga(...args) {
                const origGa = window['ga'];
                if (typeof origGa === 'function') {
                  return origGa.apply(this, args);
                }
              Severity: Major
              Found in frontend/source/js/common/ga.js and 1 other location - About 1 hr to fix
              frontend/source/js/common/ga.js on lines 16..22

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

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

              def describe(cursor, vocab, labor_category, min_years_experience,
                           education_level, price, severe_stddevs=2,
                           min_comparables=DEFAULT_MIN_COMPARABLES,
                           cache=None):
                  if cache is None:
              Severity: Minor
              Found in data_capture/analysis/core.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 step_1 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def step_1(request, step):
                  if request.method == 'GET':
                      form = forms.Step1Form(data=get_nested_item(
                          request.session,
                          (SESSION_KEY, 'step_1_POST')
              Severity: Minor
              Found in data_capture/views/price_list_upload.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

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

              def does_uid_exist(uid):  # type: (int) -> bool
                  '''
                  Returns True if the given OS user id exists, False otherwise.
                  '''
              
              
              Severity: Major
              Found in docker_django_management.py and 1 other location - About 1 hr to fix
              docker_django_management.py on lines 256..268

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

              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

              def does_username_exist(username):  # type: (str) -> bool
                  '''
                  Returns True if the given OS username exists, False otherwise.
                  '''
              
              
              Severity: Major
              Found in docker_django_management.py and 1 other location - About 1 hr to fix
              docker_django_management.py on lines 271..283

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

              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 listItem has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const listItem = (year) => {
                  const { className, shortLabel, idSuffix } = YEAR_LI_INFO[year];
                  const id = `${idPrefix}${idSuffix}`;
              
                  return (
              Severity: Minor
              Found in frontend/source/js/data-explorer/components/contract-year.jsx - About 1 hr to fix

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

                  render() {
                    const id = `${this.props.idPrefix}labor_category`;
                    let placeholder = "Type a labor category";
                
                    if (this.props.queryBy === QUERY_BY_CONTRACT) {
                Severity: Minor
                Found in frontend/source/js/data-explorer/components/labor-category.jsx - About 1 hr to fix

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

                  export function appendHighlightedTerm($el, term, searchStr) {
                    const sanitizedSearch = searchStr.replace(/[^a-z0-9 ]/gi, '')
                      .trim()
                      .split(/[ ]+/)
                      .join('|');
                  Severity: Minor
                  Found in frontend/source/js/data-explorer/autocomplete.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language