Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

max-classes-per-file: Convert to function #2545

Merged
merged 2 commits into from
Apr 12, 2017

Conversation

andy-hanson
Copy link
Contributor

@andy-hanson andy-hanson commented Apr 11, 2017

PR checklist

  • Addresses an existing issue: #0000
  • New feature, bugfix, or enhancement
    • Includes tests
  • Documentation update

Overview of change:

Just a refactor. Also added a period to failure message.

@andy-hanson andy-hanson force-pushed the max-classes-per-file branch from 4c048c7 to 8911f24 Compare April 11, 2017 01:32
}

public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
return this.applyWithWalker(new MaxClassesPerFileWalker(sourceFile, this.getOptions()));
const argument = this.ruleArguments[0];
const maxClasses = isNaN(argument) || (argument as number) < 0 ? 1 : argument;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a subtle bug here. The old implementation defaults 0 to 1. The new one doesn't.
You can also simplify this line.

const maxClasses = argument > 0 ? argument : 1;

@adidahiya adidahiya merged commit bdd8e54 into palantir:master Apr 12, 2017
@andy-hanson andy-hanson deleted the max-classes-per-file branch April 13, 2017 00:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants