JustFixNYC/tenants2

View on GitHub

Showing 29 of 84 total issues

Function Context has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

  confetti.Context = function(canvas, regenerateForSecs, onFinished) {
    if (!regenerateForSecs) {
      regenerateForSecs = 0;
    }
    if (!onFinished) {
Severity: Minor
Found in frontend/vendor/confetti.js - About 6 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 ConfettiRibbon has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

  function ConfettiRibbon(_x, _y, _count, _dist, _thickness, _angle, _mass, _drag) {
    this.particleDist = _dist;
    this.particleCount = _count;
    this.particleMass = _mass;
    this.particleDrag = _drag;
Severity: Minor
Found in frontend/vendor/confetti.js - About 5 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 ConfettiPaper has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  function ConfettiPaper(_x, _y) {
    this.pos = new Vector2(_x, _y);
    this.rotationSpeed = (random() * 600 + 800);
    this.angle = DEG_TO_RAD * random() * 360;
    this.rotation = DEG_TO_RAD * random() * 360;
Severity: Minor
Found in frontend/vendor/confetti.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 ConversationsSidebar has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

}> = ({ rawQuery, setRawQuery, query, conversations, selectedPhoneNumber }) => {
  return (
    <div className="jf-conversation-sidebar">
      <input
        className="jf-search"
Severity: Minor
Found in frontend/lib/admin/admin-conversations.tsx - 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 _get_docs_non_recursively has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_docs_non_recursively(cls) -> Dict[str, str]:
        """
        Return a dictionary mapping the names of
        this environment's variables to their
        documentation.
Severity: Minor
Found in project/util/typed_environ.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 areFieldsEqual has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function areFieldsEqual<FormInput>(
  initial: FormInput,
  current: FormInput
): boolean {
  for (let key in initial) {
Severity: Minor
Found in frontend/lib/forms/form-field-equality.ts - 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 logAmplitudeFormSubmission has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function logAmplitudeFormSubmission(options: {
  pathname: string;
  formKind: string;
  search?: string;
  formId?: string;
Severity: Minor
Found in frontend/lib/analytics/amplitude.ts - 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 ConversationPanel has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

}> = ({ selectedPhoneNumber, conversation, noSelectionMsg }) => {
  const convStalenessClasses = {
    "jf-is-stale-result": conversation.isLoadingNewInput,
    "jf-can-be-stale": true,
  };
Severity: Minor
Found in frontend/lib/admin/admin-conversations.tsx - 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 validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  validate(schema: GraphQLSchema, queries: Map<string, QueryInfo>) {
    if (this.wasValidateCalled) return;
    this.wasValidateCalled = true;
    let ast = assertNotNull(this.ast);
    let resolvedAST = ast;
Severity: Minor
Found in frontend/querybuilder/validator.ts - 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

Function update_texting_history has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def update_texting_history(
    backfill: bool = False,
    max_age: Optional[int] = None,
    silent: bool = False,
) -> Optional[datetime.datetime]:
Severity: Minor
Found in texting_history/management/commands/update_texting_history.py - 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

Function render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { props } = this;
    const { location, introProgressSection, label } = props;
    const { isTransitionEnabled } = this.state;
    let numSteps = props.steps.length;
Severity: Minor
Found in frontend/lib/progress/progress-bar.tsx - 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

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

def get() -> JustfixEnvironment:
    try:
        import dotenv

        if os.environ.get("IGNORE_JUSTFIX_ENV_FILE") != "1":
Severity: Minor
Found in project/justfix_environment.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 admin_field has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def admin_field(
    short_description: Optional[str] = None,
    allow_tags: Optional[bool] = None,
    admin_order_field: Optional[str] = None,
):
Severity: Minor
Found in project/util/admin_util.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 handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def handle(self, *args, **options):
        total = 0
        filenames = [Path(filename) for filename in options["filename"]]
        paths = filenames or iter_get_repo_files()

Severity: Minor
Found in project/management/commands/fixnewlines.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 getSortedActionCards has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function getSortedActionCards(
  data: DDOData
): { recommended: ActionCardProps[]; other: ActionCardProps[] } {
  const actionCardProps = ACTION_CARDS.map((propsCreator) =>
    propsCreator(data)
Severity: Minor
Found in frontend/lib/data-driven-onboarding/data-driven-onboarding.tsx - 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

Consider simplifying this complex logical expression.
Open

      if (((deltaX > this.options.threshold) && (deltaY > this.options.threshold)) || ((deltaX > this.options.threshold) && (deltaZ > this.options.threshold)) || ((deltaY > this.options.threshold) && (deltaZ > this.options.threshold))) {
          //calculate time in milliseconds since last shake registered
          currentTime = new Date();
          timeDifference = currentTime.getTime() - this.lastTime.getTime();

Severity: Major
Found in frontend/vendor/shake.js - About 40 mins to fix

Function validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  validate(): string[] {
    const schema = this.getSchema();
    const filenames = glob
      .sync(this.queryGlobPattern)
      .filter(isNonEmptyFileSync);
Severity: Minor
Found in frontend/querybuilder/validator.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

Function useMergedQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function useMergedQuery<
  Input extends BaseConversationInput,
  Output extends BaseConversationOutput
>(
  query: QueryLoaderQuery<Input, Output>,
Severity: Minor
Found in frontend/lib/admin/admin-conversations.tsx - 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

Function get_input_type_from_query has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_input_type_from_query(query: str) -> Optional[str]:
    """
    Given a GraphQL query for a DjangoFormMutation, return the input type, e.g.:

        >>> get_input_type_from_query(
Severity: Minor
Found in project/util/django_graphql_forms.py - 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

Function NorentConfirmation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const NorentConfirmation = NorentRequireLoginStep(() => {
  const { session } = useContext(AppContext);
  const letter = session.norentLatestLetter;
  const isInLA = session.onboardingInfo?.isInLosAngeles;
  const state =
Severity: Minor
Found in frontend/lib/norent/letter-builder/confirmation.tsx - 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

Severity
Category
Status
Source
Language