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 #111 from AtomLinter/greenkeeper-atom-linter-4.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcanemagus committed Jan 26, 2016
2 parents b224fd3 + 0338856 commit b4a4690
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 56 deletions.
19 changes: 17 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
language: objective-c
language: generic
os:
- osx

branches:
only:
- master
git:
depth: 10

env:
matrix:
- ATOM_CHANNEL=stable
- ATOM_CHANNEL=beta

notifications:
email:
Expand All @@ -7,8 +20,10 @@ notifications:

before_install:
- brew update
install:
- brew install python
- pip install pylint
- pylint --version

before_script:
- pylint --version
script: 'curl -s https://raw.githubusercontent.com/atom/ci/master/build-package.sh | sh'
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "linter-pylint",
"linter-package": true,
"main": "./lib/main",
"version": "1.2.0",
"private": true,
"description": "Lint python on the fly, using pylint",
"repository": "https://github.com/AtomLinter/linter-pylint",
"license": "MIT",
"scripts": {
"lint": "./node_modules/.bin/coffeelint lib"
},
"engines": {
"atom": ">=1"
"atom": ">=1.0.0 <2.0.0"
},
"providedServices": {
"linter": {
Expand All @@ -20,15 +20,15 @@
}
},
"dependencies": {
"atom-linter": "^4.1.1",
"atom-package-deps": "^3.0.5",
"lodash": "^4.0.0"
"atom-linter": "^4.3.4",
"atom-package-deps": "^3.0.7",
"lodash": "^4.0.1"
},
"devDependencies": {
"coffeelint": "^1.14.1",
"eslint": "^1.10.2",
"coffeelint": "^1.14.2",
"eslint": "^1.10.3",
"babel-eslint": "^4.1.6",
"eslint-config-airbnb": "latest"
"eslint-config-airbnb": "^4.0.0"
},
"package-deps": [
"linter"
Expand Down
102 changes: 56 additions & 46 deletions spec/linter-pylint-spec.js
Original file line number Diff line number Diff line change
@@ -1,76 +1,86 @@
'use babel';

import * as path from 'path';

const goodPath = path.join(__dirname, 'files', 'good.py');
const badPath = path.join(__dirname, 'files', 'bad.py');
const emptyPath = path.join(__dirname, 'files', 'empty.py');

describe('The pylint provider for Linter', () => {
const lint = require('../lib/main').provideLinter().lint;

beforeEach(() => {
waitsForPromise(() => {
return Promise.all([
waitsForPromise(() =>
Promise.all([
atom.packages.activatePackage('linter-pylint'),
atom.packages.activatePackage('language-python').then(() =>
atom.workspace.open(__dirname + '/files/good.py')
atom.workspace.open(goodPath)
)
]);
});
])
);
});

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

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

describe('checks bad.py and', () => {
let editor = null;
beforeEach(() => {
waitsForPromise(() => {
return atom.workspace.open(__dirname + '/files/bad.py').then(openEditor => {
waitsForPromise(() =>
atom.workspace.open(badPath).then(openEditor => {
editor = openEditor;
});
});
})
);
});

it('finds at least one message', () => {
return lint(editor).then(messages => {
expect(messages.length).toBeGreaterThan(0);
});
});
it('finds at least one message', () =>
waitsForPromise(() =>
lint(editor).then(messages => {
expect(messages.length).toBeGreaterThan(0);
})
)
);

it('verifies that message', () => {
return lint(editor).then(messages => {
expect(messages[0].type).toBeDefined();
expect(messages[0].type).toEqual('convention');
expect(messages[0].html).not.toBeDefined();
expect(messages[0].text).toBeDefined();
expect(messages[0].text).toEqual('C0111 Missing module docstring');
expect(messages[0].filePath).toBeDefined();
expect(messages[0].filePath).toMatch(/.+spec[\\\/]files[\\\/]bad\.py$/);
expect(messages[0].range).toBeDefined();
expect(messages[0].range.length).toEqual(2);
expect(messages[0].range).toEqual([[0, 0], [0, 4]]);
});
});
it('verifies that message', () =>
waitsForPromise(() =>
lint(editor).then(messages => {
expect(messages[0].type).toBeDefined();
expect(messages[0].type).toEqual('convention');
expect(messages[0].html).not.toBeDefined();
expect(messages[0].text).toBeDefined();
expect(messages[0].text).toEqual('C0111 Missing module docstring');
expect(messages[0].filePath).toBeDefined();
expect(messages[0].filePath).toMatch(/.+spec[\\\/]files[\\\/]bad\.py$/);
expect(messages[0].range).toBeDefined();
expect(messages[0].range.length).toEqual(2);
expect(messages[0].range).toEqual([[0, 0], [0, 4]]);
})
)
);
});

it('finds nothing wrong with an empty file', () => {
waitsForPromise(() => {
return atom.workspace.open(__dirname + '/files/empty.py').then(editor => {
return lint(editor).then(messages => {
waitsForPromise(() =>
atom.workspace.open(emptyPath).then(editor =>
lint(editor).then(messages => {
expect(messages.length).toEqual(0);
});
});
});
})
)
);
});

it('finds nothing wrong with a valid file', () => {
waitsForPromise(() => {
return atom.workspace.open(__dirname + '/files/good.py').then(editor => {
return lint(editor).then(messages => {
waitsForPromise(() =>
atom.workspace.open(goodPath).then(editor =>
lint(editor).then(messages => {
expect(messages.length).toEqual(0);
});
});
});
})
)
);
});
});

0 comments on commit b4a4690

Please sign in to comment.