atsid/generator-ats-node-webapp

View on GitHub

Showing 12 of 61 total issues

Function askFor has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  askFor() {
    const done = this.async();
    debug('prompting for input', this.options);
    const prompts = [{
      name: 'description',
Severity: Major
Found in generators/app/phases/prompting.js - About 3 hrs to fix

Function packageJson has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  packageJson() {
    this.addDependencies(
      'babel',
      'bcryptjs',
      'coffee-script',
Severity: Major
Found in generators/skeleton/phases/writing.js - About 2 hrs to fix

Function getCurrentUser has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  getCurrentUser() {
    let promise;
    if (this.state.currentUser) {
      promise = Promise.resolve(this.state.currentUser.result);
    } else if (this.state.currentUserPromise) {
Severity: Minor
Found in generators/client-react/templates/client/stores/user_store.js - 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 exports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = (email, password, done) => {
  log('authenticating user ' + email);
  return Promise.resolve(true)
    .then(() => Users.findByEmail(email))
    .then((user) => {

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

  subgenerators() {
    const composeLocal = (name) => {
      debug('composing with generator', name);
      this.composeWith(`ats-node-webapp:${name}`, {options: this.props}, {local: require.resolve(`../../${name}`)});
    };
Severity: Minor
Found in generators/app/phases/writing.js - About 1 hr to fix

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

  render() {
    const menuItems = [
      {route: '/', text: 'Home'},
      {route: '/nyan', text: 'Nyan Mode'},
    ];
Severity: Minor
Found in generators/client-react/templates/client/components/Skeleton.js - About 1 hr to fix

Function process has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  process(dir, templateDir, context) {
    fs.readdirSync(dir).forEach((file) => {
      const filePath = path.join(dir, file);
      const templatePath = path.join(templateDir, file);
      const isDirectory = fs.statSync(filePath).isDirectory();
Severity: Minor
Found in util/writer.js - About 1 hr to fix

Function packageJson has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  packageJson() {
    this.addDependencies(
      'body-parser',
      'compression',
      'cookie-parser',
Severity: Minor
Found in generators/server-full/phases/writing.js - About 1 hr to fix

Function runTests has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function runTests(sourceGlob, testGlob, reportDir, reporter = DEFAULT_SPEC_REPORTER, coverageReporters = DEFAULT_COVERAGE_REPORTERS, tdd = false) {
Severity: Minor
Found in generators/skeleton/templates/gulp/tasks/test.js - About 45 mins to fix

Function instrument has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function instrument(glob, title, action, dest, changedArgs) {
Severity: Minor
Found in generators/skeleton/templates/gulp/tasks/assets.js - About 35 mins to fix

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

module.exports = (value) => {
  if (typeof value === 'string') {
    const match = value.match(regexIso8601);
    if (match) {
      const milliseconds = Date.parse(match[0]);

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

function updateNpmScript(name, data) {
  const pkg = this.readPackageJson();
  const existing = pkg.scripts && pkg.scripts[name];

  let result = null;
Severity: Minor
Found in util/common-generator/phases/initializing.js - 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