Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Support v2 Linter API #149

Merged
merged 8 commits into from
Feb 6, 2019
Merged

Support v2 Linter API #149

merged 8 commits into from
Feb 6, 2019

Conversation

vzamanillo
Copy link
Contributor

Fixes #147

@vzamanillo
Copy link
Contributor Author

vzamanillo commented Jan 30, 2019

Ouch, whitequark/parser Warnings... related #117, #128

We always handle two types of error, exec errors and program stream errors, in the first case we show a notification with the error related information, in the second case we check the exit code and text looking for warnings, if found we will show a warning notification with the warning related information, else an error notification. A new configuration option can suppress the warning notifications to avoid notification spam to the user. This will solve CI errors.
Copy link
Contributor Author

@vzamanillo vzamanillo left a comment

Choose a reason for hiding this comment

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

Fixed

lib/main.js Show resolved Hide resolved
lib/main.js Show resolved Hide resolved
lib/main.js Show resolved Hide resolved
package.json Outdated
"type": "string"
},
"globalHamlLintYmlFile": {
"default": "",
"description": "Full path to a global Haml lint file, if no other is found",
"type": "string"
},
"suppressWarnings": {
Copy link
Member

Choose a reason for hiding this comment

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

This could possibly be misconstrued to mean "Don't show me warning severity messages".

Maybe a better name would be suppressFailures? Is there any reason we don't just want to show all errors though? Generally that means something is wrong and the user isn't going to get any usable output otherwise.

Copy link
Contributor Author

@vzamanillo vzamanillo Feb 1, 2019

Choose a reason for hiding this comment

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

What about changing the message to "Supress non-critical HAML-Lint messages" or a better way, adding an excerpt message to the results and show notification for errors only?.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Something like this

        const messages = [];

        if (output.exitCode !== 0) {
          if (output.stderr.toLowerCase().startsWith(warning)) {
            messages.push({
              severity: warning,
              excerpt: `HAML-Lint: ${output.stderr}`,
              location: {
                file: filePath,
                // first line of the file
                position: [[0, 0], [0, Infinity]],
              },
            });
          }
        } else {
          showErrorNotification('HAML-Lint: Unexpected error', output.stderr);
        }

Copy link
Contributor Author

@vzamanillo vzamanillo Feb 1, 2019

Choose a reason for hiding this comment

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

mock

Copy link
Member

Choose a reason for hiding this comment

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

Adding it as a message looks great to me!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we add the unexpected errors this way too? I mean, without notification.

Copy link
Member

Choose a reason for hiding this comment

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

The way I see it is:

  • If the message prevents other results from being returned it should be an Atom error notification
  • If other results can still be obtained from the linter then it probably should just be converted into a message on the entire first line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

suppressWarnings config. option and warning notification removed. If the message prevents other results from being returned it should be an Atom error notification, if other results can still be obtained from the linter then it probably should just be converted into a message on the entire first line
@vzamanillo
Copy link
Contributor Author

vzamanillo commented Feb 1, 2019

hehehe

Expected 2 to be 1.

If we modify the specs to match this we must ensure that the ruby versions of the CI have an old compilant syntax (or do a unsafe conditional test case)

    if (messages.length === 1) {
      expect(messages[0].severity).toBe('warning');
      expect(messages[0].excerpt).toBe(excerpt);
      expect(messages[0].description).not.toBeDefined();
      expect(messages[0].url).toBe(url);
      expect(messages[0].location.file).toBe(cawsvpath);
      expect(messages[0].location.position).toEqual([[0, 0], [0, 23]]);
    } else if (messages.length === 2) {
      expect(messages[0].severity).toBe('warning');
      expect(messages[0].excerpt).toContain('haml-lint: warning');
      expect(messages[0].description).not.toBeDefined();
      expect(messages[0].url).not.toBeDefined();
      expect(messages[0].location.file).toBe(cawsvpath);
      expect(messages[0].location.position).toEqual([[0, 0], [0, Infinity]]);
    }

Error notification if not exit code 0 and is not a warning
Conditional validation to pass tests with old compilant syntax ruby versions
Copy link
Member

@Arcanemagus Arcanemagus left a comment

Choose a reason for hiding this comment

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

This looks good just looking at the code, is it ready to merge?

@vzamanillo
Copy link
Contributor Author

This looks good just looking at the code, is it ready to merge?

Yep, it is ready!!

@Arcanemagus Arcanemagus merged commit 5d3fcdc into AtomLinter:master Feb 6, 2019
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