shootismoke/webapp

View on GitHub

Showing 59 of 59 total issues

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

                <a
                    className="text-orange"
                    href="https://twitter.com/shootismoke"
                    onClick={(): void => logEvent('Footer.Twitter.Click')}
                    rel="noreferrer"
Severity: Major
Found in src/frontend/components/Footer/Footer.tsx and 7 other locations - About 45 mins to fix
src/frontend/components/Footer/Footer.tsx on lines 39..47
src/frontend/components/Footer/Footer.tsx on lines 49..57
src/frontend/components/Footer/Footer.tsx on lines 61..69
src/frontend/components/Footer/Footer.tsx on lines 81..89
src/frontend/components/Footer/Footer.tsx on lines 104..112
src/frontend/components/Footer/Footer.tsx on lines 117..125
src/frontend/components/Footer/Footer.tsx on lines 127..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 50.

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 8 locations. Consider refactoring.
Open

                <a
                    className="text-orange"
                    href="https://github.com/shootismoke/policies/blob/main/terms/index.md"
                    onClick={(): void => logEvent('Footer.Terms.Click')}
                    rel="noreferrer"
Severity: Major
Found in src/frontend/components/Footer/Footer.tsx and 7 other locations - About 45 mins to fix
src/frontend/components/Footer/Footer.tsx on lines 39..47
src/frontend/components/Footer/Footer.tsx on lines 49..57
src/frontend/components/Footer/Footer.tsx on lines 61..69
src/frontend/components/Footer/Footer.tsx on lines 71..79
src/frontend/components/Footer/Footer.tsx on lines 81..89
src/frontend/components/Footer/Footer.tsx on lines 104..112
src/frontend/components/Footer/Footer.tsx on lines 127..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 50.

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 8 locations. Consider refactoring.
Open

                <a
                    className="text-orange"
                    href="https://github.com/shootismoke/policies/blob/main/privacy/index.md"
                    onClick={(): void => logEvent('Footer.Privacy.Click')}
                    rel="noreferrer"
Severity: Major
Found in src/frontend/components/Footer/Footer.tsx and 7 other locations - About 45 mins to fix
src/frontend/components/Footer/Footer.tsx on lines 39..47
src/frontend/components/Footer/Footer.tsx on lines 49..57
src/frontend/components/Footer/Footer.tsx on lines 61..69
src/frontend/components/Footer/Footer.tsx on lines 71..79
src/frontend/components/Footer/Footer.tsx on lines 81..89
src/frontend/components/Footer/Footer.tsx on lines 104..112
src/frontend/components/Footer/Footer.tsx 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 50.

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 8 locations. Consider refactoring.
Open

                <a
                    className="text-orange"
                    href="https://github.com/shootismoke/webapp"
                    onClick={(): void => logEvent('Footer.Github.Click')}
                    rel="noreferrer"
Severity: Major
Found in src/frontend/components/Footer/Footer.tsx and 7 other locations - About 45 mins to fix
src/frontend/components/Footer/Footer.tsx on lines 39..47
src/frontend/components/Footer/Footer.tsx on lines 49..57
src/frontend/components/Footer/Footer.tsx on lines 61..69
src/frontend/components/Footer/Footer.tsx on lines 71..79
src/frontend/components/Footer/Footer.tsx on lines 81..89
src/frontend/components/Footer/Footer.tsx on lines 117..125
src/frontend/components/Footer/Footer.tsx on lines 127..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 50.

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 8 locations. Consider refactoring.
Open

                <a
                    className="text-orange"
                    href="https://facebook.com/shootismoke"
                    onClick={(): void => logEvent('Footer.Facebook.Click')}
                    rel="noreferrer"
Severity: Major
Found in src/frontend/components/Footer/Footer.tsx and 7 other locations - About 45 mins to fix
src/frontend/components/Footer/Footer.tsx on lines 39..47
src/frontend/components/Footer/Footer.tsx on lines 49..57
src/frontend/components/Footer/Footer.tsx on lines 71..79
src/frontend/components/Footer/Footer.tsx on lines 81..89
src/frontend/components/Footer/Footer.tsx on lines 104..112
src/frontend/components/Footer/Footer.tsx on lines 117..125
src/frontend/components/Footer/Footer.tsx on lines 127..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 50.

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 8 locations. Consider refactoring.
Open

                <a
                    className="text-orange"
                    href="mailto:hi@shootismoke.app"
                    onClick={(): void => logEvent('Footer.Email.Click')}
                    rel="noreferrer"
Severity: Major
Found in src/frontend/components/Footer/Footer.tsx and 7 other locations - About 45 mins to fix
src/frontend/components/Footer/Footer.tsx on lines 39..47
src/frontend/components/Footer/Footer.tsx on lines 49..57
src/frontend/components/Footer/Footer.tsx on lines 61..69
src/frontend/components/Footer/Footer.tsx on lines 71..79
src/frontend/components/Footer/Footer.tsx on lines 104..112
src/frontend/components/Footer/Footer.tsx on lines 117..125
src/frontend/components/Footer/Footer.tsx on lines 127..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 50.

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 8 locations. Consider refactoring.
Open

                <a
                    className="text-orange"
                    href="https://amaurym.com"
                    onClick={(): void => logEvent('Footer.Amaury.Click')}
                    rel="noreferrer"
Severity: Major
Found in src/frontend/components/Footer/Footer.tsx and 7 other locations - About 45 mins to fix
src/frontend/components/Footer/Footer.tsx on lines 39..47
src/frontend/components/Footer/Footer.tsx on lines 61..69
src/frontend/components/Footer/Footer.tsx on lines 71..79
src/frontend/components/Footer/Footer.tsx on lines 81..89
src/frontend/components/Footer/Footer.tsx on lines 104..112
src/frontend/components/Footer/Footer.tsx on lines 117..125
src/frontend/components/Footer/Footer.tsx on lines 127..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 50.

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

async function emailForUser(
    user: MongoUser,
    cities: City[]
): Promise<CreateMessageOpts> {
    if (!user.emailReport) {
Severity: Minor
Found in src/backend/reports/email/main.ts - 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

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

    if (rejected.length) {
        l(`${rejected.length}/${users.length} rejected:`);
        l(rejected);
    }
Severity: Minor
Found in src/backend/reports/expo/main.ts and 1 other location - About 35 mins to fix
src/backend/reports/email/main.ts on lines 262..265

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

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

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

    if (rejected.length) {
        l(`${rejected.length}/${users.length} rejected:`);
        l(rejected);
    }
Severity: Minor
Found in src/backend/reports/email/main.ts and 1 other location - About 35 mins to fix
src/backend/reports/expo/main.ts on lines 107..110

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

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

Avoid too many return statements within this function.
Open

        return [
            `<span style="color: #f2934e;">Health alert:</span> everyone may experience more serious health effects.`,
            `Everyone should <span style="color: #f2934e;"> reduce outdoor activities,</span> especially vulnerable people.`,
        ];
Severity: Major
Found in src/backend/reports/email/tips.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return [
                `<span style="color: #f2934e;">Health alert:</span> Stop outdoor activities and move all activities indoors.`,
                `If it is necessary to go out, please <span style="color: #f2934e;">wear a mask</span>.`,
            ];
    Severity: Major
    Found in src/backend/reports/email/tips.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return false;
      Severity: Major
      Found in src/frontend/util/doNotTrack.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return [
                    <HealthTip imgAlt="warning" imgSrc={warning} key={1}>
                        <p className="type-400 md:type-500">
                            <span className="text-orange">Health alert:</span> Stop
                            outdoor activities and move all activities indoors.
        Severity: Major
        Found in src/frontend/components/PollutantSection/HealthSection/HealthSection.tsx - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return [
                      <HealthTip imgAlt="warning" imgSrc={warning} key={1}>
                          <p className="type-400 md:type-500">
                              <span className="text-orange">Health alert:</span> everyone
                              may experience more serious health effects.
          Severity: Major
          Found in src/frontend/components/PollutantSection/HealthSection/HealthSection.tsx - About 30 mins to fix

            Function Carousel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export function Carousel(props: CarouselProps): React.ReactElement {
                const {
                    children,
                    className,
                    innerClassName,
            Severity: Minor
            Found in src/frontend/components/Carousel/Carousel.tsx - 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

            Function Cigarettes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export function Cigarettes(props: CigarettesProps): React.ReactElement {
                const { cigarettes } = props;
            
                const cigaretteConfig = getCigaretteConfig(cigarettes);
            
            
            Severity: Minor
            Found in src/frontend/components/Cigarettes/Cigarettes.tsx - 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

            Function tips has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            function tips(aqi: number): React.ReactElement[] {
                if (aqi <= 50) {
                    return [
                        <HealthTip imgAlt="happy" imgSrc={happy} key={1}>
                            <p className="type-400 md:type-500">
            Severity: Minor
            Found in src/frontend/components/PollutantSection/HealthSection/HealthSection.tsx - 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

            Function tips has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export function tips(aqi: number): string[] {
                if (aqi <= 50) {
                    return [
                        `Air quality is considered <span style="color: #f2934e;">satisfactory</span>, and air pollution poses little or no risk.`,
                        `<span style="color: #f2934e;">Enjoy</span> your usual outdoor activities.`,
            Severity: Minor
            Found in src/backend/reports/email/tips.ts - 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