Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactoring: evaluate RuleElements with @sindresorhus/ow/isValid #97

Open
1 task
gregswindle opened this issue Aug 21, 2019 · 0 comments · May be fixed by #101
Open
1 task

refactoring: evaluate RuleElements with @sindresorhus/ow/isValid #97

gregswindle opened this issue Aug 21, 2019 · 0 comments · May be fixed by #101
Assignees
Labels
priority: medium Will add consumer value when released. type: breaking change Modifications affect or replace the public API. ⇧ Bumps the MAJOR semver. type: build Changes to product build. type: refactor Restructuring source code without changing its external behavior. type: test Adding, correcting, or improving tests (coverage).

Comments

@gregswindle
Copy link
Contributor

gregswindle commented Aug 21, 2019

code Refactoring proposal

1. Design summary / code smell(s)

Version 1.2.0 of archetypes-rules has:

  • 19 production dependencies
  • 62 development dependencies

2. Refactoring proposal(s)

  1. Simplify RuleContext evaluations with @sindresorhus/ow/isValid function.

  2. Rename the module @archetypes/rules.

  3. Extend all @archetypes/rules/Variables with @sindresorhus/ow methods (by ECMAScript data type).

3. Code quality improvement scores Sonar Quality Gate

  • The refactorings changes have either:

    • Reduced complexity, duplications, issues, security issues;
    • Improved maintainability or reliability; or
    • Both.

3.1. Complexity measures

These measures indicate how simple—or complicated—the control flow of the application is.
Cyclomatic Complexity
Measures the minimum number of test cases (i.e., conditional branches) are required for full test coverage.
Cognitive Complexity
Measures how difficult the application is to understand.
Version Cyclomatic Complexity Cognitive Complexity
v1.2.0 210 48
👎 v2.0.0 225 52

3.2. Source Lines Of Code (SLOC)

Version SLOC
v1.2.0 1,265
👎 v2.0.0 1,391

3.3. Dependencies (production)

Version Dependency count
v1.2.0 19
👍 v2.0.0 15

3.4. Bundle size (gzip)

Version Packed size Unpacked Size
v1.2.0 16.1 kB 68.9 kB
👎 v2.0.0 16.6 kB 71.2 kB

3.5. Code quality results summary

Measure Scores
Quality gate Sonar Alert Status Metrics
Defects (Bugs) Sonar Bugs Metrics
Duplications Sonar Duplicated Lines Density Metrics
Maintainability Sonar Code Smells Metrics
Sonar Sqale Rating Metrics
Sonar Sqale Index Metrics
Sonar Ncloc Metrics
Reliability Sonar Reliability Rating Metrics
Security Sonar Security Rating Metrics
Sonar Vulnerabilities Metrics
Test coverage Sonar Coverage Metrics
@gregswindle gregswindle added priority: medium Will add consumer value when released. type: test Adding, correcting, or improving tests (coverage). type: build Changes to product build. type: refactor Restructuring source code without changing its external behavior. labels Aug 21, 2019
@gregswindle gregswindle self-assigned this Aug 21, 2019
@gregswindle gregswindle changed the title refactoring: refactoring: evaluate RuleElements with @sindresorhus/ow/isValid Aug 21, 2019
@gregswindle gregswindle added the type: breaking change Modifications affect or replace the public API. ⇧ Bumps the MAJOR semver. label Aug 24, 2019
gregswindle added a commit that referenced this issue Aug 26, 2019
Update dev-dependencies:

1.  [email protected] --save-dev
2.  [email protected] --save-dev
3.  [email protected] --save-dev

Remove unused dev and prod dependencies.

\#97
@gregswindle gregswindle linked a pull request Aug 27, 2019 that will close this issue
3 tasks
gregswindle added a commit that referenced this issue Sep 7, 2019
Replace module lodash.hasin (4 KB) with private
function objectHasPropertyName (500 B)

#97
gregswindle added a commit that referenced this issue Sep 7, 2019
Move up function assignTypeTo for reuse.

#97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Will add consumer value when released. type: breaking change Modifications affect or replace the public API. ⇧ Bumps the MAJOR semver. type: build Changes to product build. type: refactor Restructuring source code without changing its external behavior. type: test Adding, correcting, or improving tests (coverage).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant