Use cpcpplint util

This commit is contained in:
Luis Blanco 2023-10-10 19:07:30 +04:00
parent 9d68a62da4
commit 1ca78906a9
6 changed files with 37 additions and 10 deletions

View File

@ -42,5 +42,6 @@ jobs:
- name: Run Cpplint
run: |
node -e "require('.').cpcpplint()"
cpplint --recursive ./test-addon
cpplint --recursive ./include

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "addon-tools-raub",
"version": "7.3.1",
"version": "7.4.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "addon-tools-raub",
"version": "7.3.1",
"version": "7.4.0",
"license": "MIT",
"devDependencies": {
"@types/node": "^20.8.3",

View File

@ -1,7 +1,7 @@
{
"author": "Luis Blanco <luisblanco1337@gmail.com>",
"name": "addon-tools-raub",
"version": "7.3.1",
"version": "7.4.0",
"description": "Helpers for Node.js addons and dependency packages",
"license": "MIT",
"main": "index.js",

View File

@ -1,17 +1,18 @@
set noparent
linelength=110
filter=-legal/copyright
filter=-build/include_order
filter=-build/include
filter=-build/header_guard
filter=-build/namespaces
filter=-build/include
filter=-build/include_order
filter=-build/include_what_you_use
filter=-build/namespaces
filter=-legal/copyright
filter=-readability/todo
filter=-runtime/indentation_namespace
filter=-whitespace/blank_line
filter=-whitespace/braces
filter=-whitespace/comments
filter=-whitespace/tab
filter=-whitespace/end_of_line
filter=-whitespace/indent
filter=-whitespace/operators
filter=-whitespace/parens
filter=-readability/todo
filter=-runtime/indentation_namespace
filter=-whitespace/tab

24
utils/cpcpplint.js Normal file
View File

@ -0,0 +1,24 @@
'use strict';
const { copy, exists } = require('./files');
const cpcpplint = async () => {
const cpplintDest = `${process.cwd()}/CPPLINT.cfg`.replace(/\\/g, '/');
const cpplintSrc = `${__dirname}/CPPLINT.cfg`.replace(/\\/g, '/');
if (!await exists(cpplintSrc) ) {
console.error('Error. File "CPPLINT.cfg" not found.');
return;
}
if (await exists(cpplintDest) ) {
console.warn('Warning. Dest "CPPLINT.cfg" exists and will be overwritten.');
}
await copy(cpplintSrc, cpplintDest);
console.log(`"CPPLINT.cfg" was copied to "${cpplintDest}".`);
};
module.exports = { cpcpplint };

View File

@ -5,6 +5,7 @@ module.exports = Object.assign(
{},
require('./action-pack'),
require('./cpbin'),
require('./cpcpplint'),
require('./download'),
require('./files'),
require('./install'),