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

Commit 07503f1

Browse files
authored
Merge pull request #60 from AtomLinter/arcanemagus/maintenance
Maintenance
2 parents d2947e9 + ac8da2e commit 07503f1

File tree

11 files changed

+222
-120
lines changed

11 files changed

+222
-120
lines changed

.circleci/config.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
version: 2
2+
3+
defaults: &defaults
4+
working_directory: /tmp/project
5+
docker:
6+
- image: arcanemagus/atom-docker-ci:stable
7+
steps:
8+
# Restore project state
9+
- attach_workspace:
10+
at: /tmp
11+
- run:
12+
name: Install Julia v0.6.4
13+
command: |
14+
curl -o julia.tar.gz --location --silent --show-error \
15+
https://julialang-s3.julialang.org/bin/linux/x64/0.6/julia-0.6.4-linux-x86_64.tar.gz && \
16+
mkdir julia && \
17+
tar --extract --gzip --strip 1 --directory=julia --file=julia.tar.gz && \
18+
echo 'export PATH="/tmp/project/julia/bin:$PATH"' >> $BASH_ENV
19+
- run:
20+
name: Julia version
21+
command: julia --version
22+
- run:
23+
name: Install Lint.jl
24+
# Note the "using Lint" is to pre-compile the cache
25+
command: julia -E 'Pkg.add("Lint"); using Lint;'
26+
- run:
27+
name: Lint.jl version
28+
command: julia -E 'Pkg.installed("Lint")'
29+
- run:
30+
name: Create VFB for Atom to run in
31+
command: /usr/local/bin/xvfb_start
32+
- run:
33+
name: Atom version
34+
command: ${ATOM_SCRIPT_PATH} --version
35+
- run:
36+
name: APM version
37+
command: ${APM_SCRIPT_PATH} --version
38+
- run:
39+
name: Package APM package dependencies
40+
command: |
41+
if [ -n "${APM_TEST_PACKAGES}" ]; then
42+
for pack in ${APM_TEST_PACKAGES}; do
43+
${APM_SCRIPT_PATH} install "${pack}"
44+
done
45+
fi;
46+
- run:
47+
name: Package dependencies
48+
command: ${APM_SCRIPT_PATH} install
49+
- run:
50+
name: Cleaning package
51+
command: ${APM_SCRIPT_PATH} clean
52+
- run:
53+
name: Package specs
54+
command: ${ATOM_SCRIPT_PATH} --test spec
55+
# Cache node_modules
56+
- save_cache:
57+
paths:
58+
- node_modules
59+
key: v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "package-lock.json"}}
60+
61+
jobs:
62+
checkout_code:
63+
<<: *defaults
64+
docker:
65+
- image: circleci/node:latest
66+
steps:
67+
- checkout
68+
# Restore node_modules from the last build
69+
- restore_cache:
70+
keys:
71+
# Get latest cache for this package.json and package-lock.json
72+
- v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "package-lock.json"}}
73+
# Fallback to the current package.json
74+
- v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}-
75+
# Fallback to the last build for this branch
76+
- v1-dependencies-{{ .Branch }}-
77+
# Fallback to the last available master branch cache
78+
- v1-dependencies-master-
79+
# Don't go further down to prevent dependency issues from other branches
80+
# Save project state for next steps
81+
- persist_to_workspace:
82+
root: /tmp
83+
paths:
84+
- project
85+
lint:
86+
<<: *defaults
87+
docker:
88+
- image: circleci/node:lts
89+
steps:
90+
# Restore project state
91+
- attach_workspace:
92+
at: /tmp
93+
- run:
94+
name: Node.js Version
95+
command: node --version
96+
- run:
97+
name: NPM Version
98+
command: npm --version
99+
- run:
100+
name: Install any remaining dependencies
101+
command: npm install
102+
- run:
103+
name: Lint code
104+
command: npm run lint
105+
stable:
106+
<<: *defaults
107+
beta:
108+
<<: *defaults
109+
docker:
110+
- image: arcanemagus/atom-docker-ci:beta
111+
112+
workflows:
113+
version: 2
114+
test_package:
115+
jobs:
116+
- checkout_code
117+
- lint:
118+
requires:
119+
- checkout_code
120+
- stable:
121+
requires:
122+
- lint
123+
- beta:
124+
requires:
125+
- lint

circle.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

lib/index.js

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type { Server } from './types';
88
let spawnedServer: ?Server = null;
99
let subscriptions: ?Object = null;
1010

11+
let executablePath;
1112
let ignoreInfo;
1213
let ignoreWarning;
1314
let showErrorCodes;
@@ -17,33 +18,36 @@ export function activate() {
1718
// eslint-disable-next-line global-require
1819
require('atom-package-deps').install('linter-julia');
1920
subscriptions = new CompositeDisposable();
20-
subscriptions.add(atom.config.observe('linter-julia.executablePath', async (executablePath) => {
21-
if (spawnedServer) {
22-
try {
23-
await terminateServer(spawnedServer);
24-
spawnedServer = null;
25-
spawnedServer = await spawnServer(executablePath);
26-
} catch (e) {
27-
const message = '[Linter-Julia] '
28-
+ 'Unable to spawn server after config change';
29-
atom.notifications.addError(`${message}. See console for details.`);
30-
// eslint-disable-next-line no-console
31-
console.error(`${message}: `, e);
21+
subscriptions.add(
22+
atom.config.observe('linter-julia.executablePath', async (value) => {
23+
executablePath = value;
24+
if (spawnedServer) {
25+
try {
26+
await terminateServer(spawnedServer);
27+
spawnedServer = null;
28+
spawnedServer = await spawnServer(executablePath);
29+
} catch (e) {
30+
const message = '[Linter-Julia] '
31+
+ 'Unable to spawn server after config change';
32+
atom.notifications.addError(`${message}. See console for details.`);
33+
// eslint-disable-next-line no-console
34+
console.error(`${message}: `, e);
35+
}
3236
}
33-
}
34-
}));
35-
subscriptions.add(atom.config.observe('linter-julia.ignoreInfo', (_ignoreInfo) => {
36-
ignoreInfo = _ignoreInfo;
37-
}));
38-
subscriptions.add(atom.config.observe('linter-julia.ignoreWarning', (_ignoreWarning) => {
39-
ignoreWarning = _ignoreWarning;
40-
}));
41-
subscriptions.add(atom.config.observe('linter-julia.showErrorCodes', (_showErrorCodes) => {
42-
showErrorCodes = _showErrorCodes;
43-
}));
44-
subscriptions.add(atom.config.observe('linter-julia.ignoreIssueCodes', (_ignoreIssueCodes) => {
45-
ignoreIssueCodes = _ignoreIssueCodes;
46-
}));
37+
}),
38+
atom.config.observe('linter-julia.ignoreInfo', (value) => {
39+
ignoreInfo = value;
40+
}),
41+
atom.config.observe('linter-julia.ignoreWarning', (value) => {
42+
ignoreWarning = value;
43+
}),
44+
atom.config.observe('linter-julia.showErrorCodes', (value) => {
45+
showErrorCodes = value;
46+
}),
47+
atom.config.observe('linter-julia.ignoreIssueCodes', (value) => {
48+
ignoreIssueCodes = value;
49+
}),
50+
);
4751
}
4852

4953
export function deactivate() {
@@ -60,14 +64,14 @@ export function provideLinter() {
6064
return {
6165
name: 'Julia',
6266
scope: 'file',
63-
lintsOnChange: false,
67+
lintsOnChange: true,
6468
grammarScopes: ['source.julia'],
6569
async lint(textEditor: Object) {
6670
if (!spawnedServer) {
67-
spawnedServer = await spawnServer(atom.config.get('linter-julia.executablePath'));
71+
spawnedServer = await spawnServer(executablePath);
6872
}
6973
const connection = net.createConnection(spawnedServer.path);
70-
connection.on('connect', () => {
74+
connection.on('connect', function writeData() {
7175
this.write(JSON.stringify({
7276
file: textEditor.getPath(),
7377
code_str: textEditor.getText(),

lib/julia-server.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
using Lint
22

33
named_pipe = ARGS[1]
4-
notinstalled = Pkg.installed("Lint") == nothing
54

6-
if notinstalled
5+
if Pkg.installed("Lint") == nothing
76
print(STDERR, "linter-julia-installing-lint")
87
try
98
Pkg.add("Lint")

lib/server.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const JULIA_SERVER_PATH = Path.join(__dirname, 'julia-server.jl');
1212

1313
export async function getPipePath(): Promise<string> {
1414
const baseDir = process.platform === 'win32' ? '\\\\.\\pipe\\' : `${os.tmpdir()}/`;
15-
const uniqueId = uuid.sync();
15+
const uniqueId = uuid();
1616
return baseDir + uniqueId;
1717
}
1818

@@ -42,12 +42,13 @@ export async function spawnServer(juliaExecutable: string): Promise<Server> {
4242
data.stderr += chunk.toString('utf8');
4343
},
4444
exit(exitCode) {
45-
// eslint-disable-next-line no-console
46-
console.debug(
47-
'[Linter-Julia] Server exited with code:', exitCode,
48-
'STDOUT:', data.stdout,
49-
'STDERR:', data.stderr,
50-
);
45+
if (atom.inDevMode()) {
46+
/* eslint-disable no-console */
47+
console.debug(`[Linter-Julia] Server exited with code: ${exitCode}`);
48+
console.debug(`STDOUT: ${data.stdout}`);
49+
console.debug(`STDERR: ${data.stderr}`);
50+
/* eslint-enable no-console */
51+
}
5152
},
5253
});
5354

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"eslint": "5.14.0",
4242
"eslint-config-airbnb-base": "13.1.0",
4343
"eslint-plugin-import": "2.16.0",
44-
"flow-bin": "0.93.0"
44+
"flow-bin": "0.93.0",
45+
"jasmine-fix": "1.3.1"
4546
},
4647
"configSchema": {
4748
"executablePath": {

spec/fixtures/bad.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function theQuestion()
2+
return question
3+
end

spec/fixtures/good.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function theAnswer()
2+
return 42
3+
end

spec/linter-julia-spec.coffee

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)