Skip to content

Commit 3bfd04e

Browse files
committed
Run codacy action separate for each language
1 parent 88fd680 commit 3bfd04e

File tree

5 files changed

+16
-297
lines changed

5 files changed

+16
-297
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,8 @@ jobs:
3737

3838
- name: Run tests with coverage
3939
if: matrix.node-version >= 20
40-
env:
41-
NODE_V8_COVERAGE: coverage/tmp
4240
run: yarn test-coverage
4341

44-
- name: Generate coverage
45-
if: matrix.node-version >= 20 && matrix.os == 'ubuntu-20.04'
46-
run: |
47-
sudo apt install lcov
48-
npx c8 report --reporter=text-lcov > lcov-js.info
49-
lcov -c -d . --no-external -o lcov-cpp.info
50-
lcov -r lcov-cpp.info "*/node_modules/*" -o lcov-cpp.info
51-
52-
- name: Send coverage to Codacy
53-
if: matrix.node-version >= 20 && matrix.os == 'ubuntu-20.04'
54-
uses: codacy/codacy-coverage-reporter-action@v1
55-
with:
56-
coverage-reports: lcov-cpp.info, lcov-js.info
57-
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
58-
5942
test-alpine:
6043
name: Test on Alpine Linux
6144
runs-on: ubuntu-latest

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
[![Financial contributors on Open Collective][opencollective-image]][opencollective-url]
44
[![Build status][actions-image]][actions-url]
55
[![NPM package][npm-image]][npm-url]
6-
[![Coverage status][coverage-image]][coverage-url]
7-
[![Code Quality][codequality-image]][codequality-url]
86

97
Bindings to the reference [Argon2](https://github.com/P-H-C/phc-winner-argon2)
108
implementation.
@@ -212,7 +210,3 @@ license over Argon2 and the reference implementation.
212210
[npm-url]: https://www.npmjs.com/package/argon2
213211
[actions-image]: https://img.shields.io/github/actions/workflow/status/ranisalt/node-argon2/ci.yml?branch=master&style=flat-square
214212
[actions-url]: https://github.com/ranisalt/node-argon2/actions
215-
[coverage-image]: https://img.shields.io/codacy/coverage/3aa6daee00154e1492660ecb2f788f73/master.svg?style=flat-square
216-
[coverage-url]: https://app.codacy.com/gh/ranisalt/node-argon2
217-
[codequality-image]: https://img.shields.io/codacy/grade/3aa6daee00154e1492660ecb2f788f73/master.svg?style=flat-square
218-
[codequality-url]: https://app.codacy.com/gh/ranisalt/node-argon2

argon2.mjs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
"use strict";
2-
const assert = require("node:assert");
3-
const { randomBytes, timingSafeEqual } = require("node:crypto");
4-
const { promisify } = require("node:util");
5-
const { deserialize, serialize } = require("@phc/format");
6-
const gypBuild = require("node-gyp-build");
1+
import assert from "node:assert";
2+
import { randomBytes, timingSafeEqual } from "node:crypto";
3+
import { fileURLToPath } from "node:url";
4+
import { promisify } from "node:util";
5+
import { deserialize, serialize } from "@phc/format";
6+
import gypBuild from "node-gyp-build";
77

88
const { hash: _hash } = gypBuild(fileURLToPath(new URL(".", import.meta.url)));
99

@@ -12,8 +12,12 @@ const bindingsHash = promisify(_hash);
1212
/** @type {(size: number) => Promise<Buffer>} */
1313
const generateSalt = promisify(randomBytes);
1414

15-
/** @enum {0 | 1 | 2} */
16-
const types = Object.freeze({ argon2d: 0, argon2i: 1, argon2id: 2 });
15+
export const argon2d = 0;
16+
export const argon2i = 1;
17+
export const argon2id = 2;
18+
19+
/** @enum {argon2i | argon2d | argon2id} */
20+
const types = Object.freeze({ argon2d, argon2i, argon2id });
1721

1822
/** @enum {'argon2d' | 'argon2i' | 'argon2id'} */
1923
const names = Object.freeze({
@@ -74,7 +78,7 @@ export const limits = Object.freeze({
7478
* @param {Options & { raw?: boolean }} options
7579
* @returns {Promise<Buffer | string>}
7680
*/
77-
async function hash(plain, options) {
81+
export async function hash(plain, options) {
7882
const { raw, salt, saltLength, ...rest } = { ...defaults, ...options };
7983

8084
for (const [key, { min, max }] of Object.entries(limits)) {
@@ -115,7 +119,7 @@ async function hash(plain, options) {
115119
* @param {Options} [options] The current parameters for Argon2
116120
* @return {boolean} `true` if the digest parameters do not match the parameters in `options`, otherwise `false`
117121
*/
118-
function needsRehash(digest, options) {
122+
export function needsRehash(digest, options) {
119123
const { memoryCost, timeCost, version } = { ...defaults, ...options };
120124

121125
const {
@@ -132,7 +136,7 @@ function needsRehash(digest, options) {
132136
* @param {Options} [options] The current parameters for Argon2
133137
* @return {Promise<boolean>} `true` if the digest parameters matches the hash generated from `plain`, otherwise `false`
134138
*/
135-
async function verify(digest, plain, options) {
139+
export async function verify(digest, plain, options) {
136140
const {
137141
id,
138142
version = 0x10,
@@ -160,5 +164,3 @@ async function verify(digest, plain, options) {
160164
)
161165
);
162166
}
163-
164-
module.exports = { defaults, hash, needsRehash, verify, ...types };

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
},
5555
"scripts": {
5656
"build": "prebuildify --napi --strip --tag-armv --tag-libc",
57-
"format": "prettier --write \"*.{js,json}\"",
57+
"format": "prettier --write \"*.{json,mjs}\"",
5858
"install": "node-gyp-build",
5959
"prepack": "yarn prepare",
6060
"prepare": "tsc",

test.js

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

0 commit comments

Comments
 (0)