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 #60 from AtomLinter/arcanemagus/maintenance
Browse files Browse the repository at this point in the history
Maintenance
  • Loading branch information
Arcanemagus authored Feb 19, 2019
2 parents d2947e9 + ac8da2e commit 07503f1
Show file tree
Hide file tree
Showing 11 changed files with 222 additions and 120 deletions.
125 changes: 125 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
version: 2

defaults: &defaults
working_directory: /tmp/project
docker:
- image: arcanemagus/atom-docker-ci:stable
steps:
# Restore project state
- attach_workspace:
at: /tmp
- run:
name: Install Julia v0.6.4
command: |
curl -o julia.tar.gz --location --silent --show-error \
https://julialang-s3.julialang.org/bin/linux/x64/0.6/julia-0.6.4-linux-x86_64.tar.gz && \
mkdir julia && \
tar --extract --gzip --strip 1 --directory=julia --file=julia.tar.gz && \
echo 'export PATH="/tmp/project/julia/bin:$PATH"' >> $BASH_ENV
- run:
name: Julia version
command: julia --version
- run:
name: Install Lint.jl
# Note the "using Lint" is to pre-compile the cache
command: julia -E 'Pkg.add("Lint"); using Lint;'
- run:
name: Lint.jl version
command: julia -E 'Pkg.installed("Lint")'
- run:
name: Create VFB for Atom to run in
command: /usr/local/bin/xvfb_start
- run:
name: Atom version
command: ${ATOM_SCRIPT_PATH} --version
- run:
name: APM version
command: ${APM_SCRIPT_PATH} --version
- run:
name: Package APM package dependencies
command: |
if [ -n "${APM_TEST_PACKAGES}" ]; then
for pack in ${APM_TEST_PACKAGES}; do
${APM_SCRIPT_PATH} install "${pack}"
done
fi;
- run:
name: Package dependencies
command: ${APM_SCRIPT_PATH} install
- run:
name: Cleaning package
command: ${APM_SCRIPT_PATH} clean
- run:
name: Package specs
command: ${ATOM_SCRIPT_PATH} --test spec
# Cache node_modules
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "package-lock.json"}}

jobs:
checkout_code:
<<: *defaults
docker:
- image: circleci/node:latest
steps:
- checkout
# Restore node_modules from the last build
- restore_cache:
keys:
# Get latest cache for this package.json and package-lock.json
- v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "package-lock.json"}}
# Fallback to the current package.json
- v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}-
# Fallback to the last build for this branch
- v1-dependencies-{{ .Branch }}-
# Fallback to the last available master branch cache
- v1-dependencies-master-
# Don't go further down to prevent dependency issues from other branches
# Save project state for next steps
- persist_to_workspace:
root: /tmp
paths:
- project
lint:
<<: *defaults
docker:
- image: circleci/node:lts
steps:
# Restore project state
- attach_workspace:
at: /tmp
- run:
name: Node.js Version
command: node --version
- run:
name: NPM Version
command: npm --version
- run:
name: Install any remaining dependencies
command: npm install
- run:
name: Lint code
command: npm run lint
stable:
<<: *defaults
beta:
<<: *defaults
docker:
- image: arcanemagus/atom-docker-ci:beta

workflows:
version: 2
test_package:
jobs:
- checkout_code
- lint:
requires:
- checkout_code
- stable:
requires:
- lint
- beta:
requires:
- lint
19 changes: 0 additions & 19 deletions circle.yml

This file was deleted.

62 changes: 33 additions & 29 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { Server } from './types';
let spawnedServer: ?Server = null;
let subscriptions: ?Object = null;

let executablePath;
let ignoreInfo;
let ignoreWarning;
let showErrorCodes;
Expand All @@ -17,33 +18,36 @@ export function activate() {
// eslint-disable-next-line global-require
require('atom-package-deps').install('linter-julia');
subscriptions = new CompositeDisposable();
subscriptions.add(atom.config.observe('linter-julia.executablePath', async (executablePath) => {
if (spawnedServer) {
try {
await terminateServer(spawnedServer);
spawnedServer = null;
spawnedServer = await spawnServer(executablePath);
} catch (e) {
const message = '[Linter-Julia] '
+ 'Unable to spawn server after config change';
atom.notifications.addError(`${message}. See console for details.`);
// eslint-disable-next-line no-console
console.error(`${message}: `, e);
subscriptions.add(
atom.config.observe('linter-julia.executablePath', async (value) => {
executablePath = value;
if (spawnedServer) {
try {
await terminateServer(spawnedServer);
spawnedServer = null;
spawnedServer = await spawnServer(executablePath);
} catch (e) {
const message = '[Linter-Julia] '
+ 'Unable to spawn server after config change';
atom.notifications.addError(`${message}. See console for details.`);
// eslint-disable-next-line no-console
console.error(`${message}: `, e);
}
}
}
}));
subscriptions.add(atom.config.observe('linter-julia.ignoreInfo', (_ignoreInfo) => {
ignoreInfo = _ignoreInfo;
}));
subscriptions.add(atom.config.observe('linter-julia.ignoreWarning', (_ignoreWarning) => {
ignoreWarning = _ignoreWarning;
}));
subscriptions.add(atom.config.observe('linter-julia.showErrorCodes', (_showErrorCodes) => {
showErrorCodes = _showErrorCodes;
}));
subscriptions.add(atom.config.observe('linter-julia.ignoreIssueCodes', (_ignoreIssueCodes) => {
ignoreIssueCodes = _ignoreIssueCodes;
}));
}),
atom.config.observe('linter-julia.ignoreInfo', (value) => {
ignoreInfo = value;
}),
atom.config.observe('linter-julia.ignoreWarning', (value) => {
ignoreWarning = value;
}),
atom.config.observe('linter-julia.showErrorCodes', (value) => {
showErrorCodes = value;
}),
atom.config.observe('linter-julia.ignoreIssueCodes', (value) => {
ignoreIssueCodes = value;
}),
);
}

export function deactivate() {
Expand All @@ -60,14 +64,14 @@ export function provideLinter() {
return {
name: 'Julia',
scope: 'file',
lintsOnChange: false,
lintsOnChange: true,
grammarScopes: ['source.julia'],
async lint(textEditor: Object) {
if (!spawnedServer) {
spawnedServer = await spawnServer(atom.config.get('linter-julia.executablePath'));
spawnedServer = await spawnServer(executablePath);
}
const connection = net.createConnection(spawnedServer.path);
connection.on('connect', () => {
connection.on('connect', function writeData() {
this.write(JSON.stringify({
file: textEditor.getPath(),
code_str: textEditor.getText(),
Expand Down
3 changes: 1 addition & 2 deletions lib/julia-server.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using Lint

named_pipe = ARGS[1]
notinstalled = Pkg.installed("Lint") == nothing

if notinstalled
if Pkg.installed("Lint") == nothing
print(STDERR, "linter-julia-installing-lint")
try
Pkg.add("Lint")
Expand Down
15 changes: 8 additions & 7 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const JULIA_SERVER_PATH = Path.join(__dirname, 'julia-server.jl');

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

Expand Down Expand Up @@ -42,12 +42,13 @@ export async function spawnServer(juliaExecutable: string): Promise<Server> {
data.stderr += chunk.toString('utf8');
},
exit(exitCode) {
// eslint-disable-next-line no-console
console.debug(
'[Linter-Julia] Server exited with code:', exitCode,
'STDOUT:', data.stdout,
'STDERR:', data.stderr,
);
if (atom.inDevMode()) {
/* eslint-disable no-console */
console.debug(`[Linter-Julia] Server exited with code: ${exitCode}`);
console.debug(`STDOUT: ${data.stdout}`);
console.debug(`STDERR: ${data.stderr}`);
/* eslint-enable no-console */
}
},
});

Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"eslint": "5.14.0",
"eslint-config-airbnb-base": "13.1.0",
"eslint-plugin-import": "2.16.0",
"flow-bin": "0.93.0"
"flow-bin": "0.93.0",
"jasmine-fix": "1.3.1"
},
"configSchema": {
"executablePath": {
Expand Down
3 changes: 3 additions & 0 deletions spec/fixtures/bad.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function theQuestion()
return question
end
3 changes: 3 additions & 0 deletions spec/fixtures/good.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function theAnswer()
return 42
end
62 changes: 0 additions & 62 deletions spec/linter-julia-spec.coffee

This file was deleted.

Loading

0 comments on commit 07503f1

Please sign in to comment.