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

Commit

Permalink
Merge pull request #124 from vzamanillo/use-activationhooks
Browse files Browse the repository at this point in the history
Switch to scope activationHook from language package
  • Loading branch information
Arcanemagus authored Feb 28, 2019
2 parents 79b9526 + ffa4fde commit 1df159c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/linter-reek.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ export default {
provideLinter() {
return {
name: 'reek',
grammarScopes: ['source.ruby', 'source.ruby.rails', 'source.ruby.rspec'],
grammarScopes: [
'source.ruby',
'source.ruby.rails',
'source.ruby.rspec',
],
scope: 'file',
lintsOnChange: false,
lint: async (editor) => {
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"default": "reek"
}
},
"activationHooks": [
"source.ruby:root-scope-used",
"source.ruby.rails:root-scope-used",
"source.ruby.rspec:root-scope-used"
],
"engines": {
"atom": ">=1.7.0 <2.0.0"
},
Expand Down
16 changes: 15 additions & 1 deletion spec/linter-reek-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,22 @@ const badFile = path.join(__dirname, 'fixtures', 'bad.rb');
describe('The reek provider for Linter', () => {
beforeEach(async () => {
atom.workspace.destroyActivePaneItem();

const activationPromise = atom.packages.activatePackage('linter-reek');

await atom.packages.activatePackage('language-ruby');
await atom.packages.activatePackage('linter-reek');
await atom.workspace.open(goodFile);

atom.packages.triggerDeferredActivationHooks();
await activationPromise;
});

it('should be in the packages list', () => {
expect(atom.packages.isPackageLoaded('linter-reek')).toBe(true);
});

it('should be an active package', () => {
expect(atom.packages.isPackageActive('linter-reek')).toBe(true);
});

it('checks a file with issues and reports the correct message', async () => {
Expand Down

0 comments on commit 1df159c

Please sign in to comment.