Skip to content

Commit

Permalink
Release v1.1.7 (#26)
Browse files Browse the repository at this point in the history
- ci: replace travis & appveyor with GitHub actions
- test: replace nodeunit with mocha
- test: update header checks against lower cased header names
  • Loading branch information
msimerson committed Jun 6, 2022
1 parent a37a07f commit c761a4c
Show file tree
Hide file tree
Showing 16 changed files with 112 additions and 76 deletions.
6 changes: 3 additions & 3 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
engines:
engines:
eslint:
enabled: true
channel: "eslint-3"
channel: "eslint-8"
config:
config: ".eslintrc.json"
config: ".eslintrc.yaml"

ratings:
paths:
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ env:
node: true
es6: true
mocha: true
es2020: true

plugins:
- haraka
Expand Down
2 changes: 0 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ Checklist:
- [ ] docs updated
- [ ] tests updated
- [ ] Changes.md updated
- [ ] package.json.version bumped
- [ ] published to NPM (will be done by @core)
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
allow:
- dependency-type: production
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on: [ push ]

env:
CI: true

jobs:

lint:
uses: haraka/.github/.github/workflows/lint.yml@master

# coverage:
# uses: haraka/.github/.github/workflows/coverage.yml@master
# secrets: inherit

test:
needs: [ lint, get-lts ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
node-version: ${{ fromJson(needs.get-lts.outputs.active) }}
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test

get-lts:
runs-on: ubuntu-latest
steps:
- id: get
uses: msimerson/node-lts-versions@v1
outputs:
active: ${{ steps.get.outputs.active }}
lts: ${{ steps.get.outputs.lts }}
13 changes: 13 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '18 7 * * 4'

jobs:
codeql:
uses: haraka/.github/.github/workflows/codeql.yml@master
14 changes: 14 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: publish

on:
push:
branches:
- master

env:
CI: true

jobs:
publish:
uses: haraka/.github/.github/workflows/publish.yml@master
secrets: inherit
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ jspm_packages
# Optional REPL history
.node_repl_history

package-lock.json
package-lock.json
haraka-update.sh
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule ".release"]
path = .release
url = git@github.com:msimerson/.release.git
1 change: 1 addition & 0 deletions .release
Submodule .release added at 9be2b2
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

7 changes: 5 additions & 2 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
### Unreleased

## 1.1.N - 2020-MM-DD
## 1.1.7 - 2022-06-05

- replace nodeunit with mocha
- ci: replace travis & appveyor with GitHub actions
- test: replace nodeunit with mocha
- test: update header checks against lower cased header names


## 1.1.6 - 2020-02-29
Expand Down
20 changes: 0 additions & 20 deletions appveyor.yml

This file was deleted.

10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ exports.get_clean = function (data, connection) {
clean[key] = data[key];
break;
default:
connection.loginfo(plugin, "skipping unhandled: " + typeof data[key]);
connection.loginfo(plugin, `skipping unhandled: ${ typeof data[key]}`);
}
});

Expand Down Expand Up @@ -393,7 +393,7 @@ exports.parse_response = function (rawData, connection) {
}
catch (err) {
connection.transaction.results.add(plugin, {
err: 'parse failure: ' + err.message
err: `parse failure: ${ err.message}`
});
return;
}
Expand All @@ -408,7 +408,7 @@ exports.parse_response = function (rawData, connection) {
}

return {
'data' : data,
data,
'log' : plugin.get_clean(data, connection),
};
}
Expand Down Expand Up @@ -442,7 +442,7 @@ exports.add_headers = function (connection, data) {
const prettySymbols = [];
for (const k in data.symbols) {
if (data.symbols[k].score) {
prettySymbols.push(data.symbols[k].name + '(' + data.symbols[k].score + ')');
prettySymbols.push(`${data.symbols[k].name }(${ data.symbols[k].score })`);
}
}
connection.transaction.remove_header(cfg.header.report);
Expand All @@ -452,6 +452,6 @@ exports.add_headers = function (connection, data) {

if (cfg.header && cfg.header.score) {
connection.transaction.remove_header(cfg.header.score);
connection.transaction.add_header(cfg.header.score, '' + data.score);
connection.transaction.add_header(cfg.header.score, `${ data.score}`);
}
}
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"name": "haraka-plugin-rspamd",
"version": "1.1.6",
"version": "1.1.7",
"description": "Haraka plugin for rspamd",
"main": "index.js",
"scripts": {
"lint": "npx eslint *.js test/**/*.js",
"lintfix": "./node_modules/.bin/eslint --fix *.js test/**/*.js",
"cover": "npx istanbul cover npm run test",
"test": "npx mocha"
"lint": "npx eslint *.js test",
"lintfix": "npx eslint --fix *.js test",
"test": "npx _mocha"
},
"repository": {
"type": "git",
Expand All @@ -25,10 +24,10 @@
},
"homepage": "https://github.com/haraka/haraka-plugin-rspamd#readme",
"devDependencies": {
"eslint": ">=4",
"eslint": ">=8",
"eslint-plugin-haraka": "*",
"haraka-test-fixtures": "*",
"mocha": "*"
"haraka-test-fixtures": "^1.0.35",
"mocha": ">=9"
},
"dependencies": {
"haraka-dsn": "*"
Expand Down
14 changes: 7 additions & 7 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ function _set_up (done) {
this.plugin = new fixtures.plugin('rspamd');
this.plugin.register();
this.connection = connection.createConnection();
this.connection.init_transaction();
this.connection.transaction = fixtures.transaction.createTransaction()
// this.connection.init_transaction();

done();
}
Expand Down Expand Up @@ -39,7 +40,6 @@ describe('add_headers', function () {
it('add_headers exists as function', function (done) {
// console.log(this.plugin.cfg);
assert.equal('function', typeof this.plugin.add_headers);
// assert.ok(!this.plugin.score_too_high(this.connection, {score: 5}));
done();
})

Expand All @@ -62,9 +62,9 @@ describe('add_headers', function () {
};
this.plugin.cfg.main.add_headers = 'always';
this.plugin.add_headers(this.connection, test_data);
assert.equal(this.connection.transaction.header.headers['X-Rspamd-Score'], '1.1');
assert.equal(this.connection.transaction.header.headers['X-Rspamd-Bar'], '+');
assert.equal(this.connection.transaction.header.headers['X-Rspamd-Report'], 'FOO(0.1) BAR(1)');
assert.deepEqual(this.connection.transaction.header.headers['x-rspamd-score'], [ '1.1' ]);
assert.deepEqual(this.connection.transaction.header.headers['x-rspamd-bar'], ['+']);
assert.deepEqual(this.connection.transaction.header.headers['x-rspamd-report'], ['FOO(0.1) BAR(1)']);
done();
})

Expand All @@ -75,8 +75,8 @@ describe('add_headers', function () {
this.plugin.cfg.main.add_headers = 'always';
this.plugin.add_headers(this.connection, test_data);
// console.log(this.connection.transaction.header);
assert.equal(this.connection.transaction.header.headers['X-Rspamd-Score'], '-1');
assert.equal(this.connection.transaction.header.headers['X-Rspamd-Bar'], '-');
assert.deepEqual(this.connection.transaction.header.headers['x-rspamd-score'], ['-1']);
assert.deepEqual(this.connection.transaction.header.headers['x-rspamd-bar'], ['-']);
done();
})
})
Expand Down

0 comments on commit c761a4c

Please sign in to comment.