mirror of
https://github.com/lovell/sharp.git
synced 2025-12-06 03:51:40 +01:00
Modernise C++ linter using new @cpplint/cli tooling
This commit is contained in:
parent
adb6275ae9
commit
54722dd582
@ -96,7 +96,7 @@
|
|||||||
"clean": "rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",
|
"clean": "rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",
|
||||||
"test": "npm run lint && npm run test-unit",
|
"test": "npm run lint && npm run test-unit",
|
||||||
"lint": "npm run lint-cpp && npm run lint-js && npm run lint-types",
|
"lint": "npm run lint-cpp && npm run lint-js && npm run lint-types",
|
||||||
"lint-cpp": "cpplint",
|
"lint-cpp": "cpplint --quiet src/*.h src/*.cc",
|
||||||
"lint-js": "biome lint",
|
"lint-js": "biome lint",
|
||||||
"lint-types": "tsd --files ./test/types/sharp.test-d.ts",
|
"lint-types": "tsd --files ./test/types/sharp.test-d.ts",
|
||||||
"test-leak": "./test/leak/leak.sh",
|
"test-leak": "./test/leak/leak.sh",
|
||||||
@ -168,6 +168,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^2.2.4",
|
"@biomejs/biome": "^2.2.4",
|
||||||
|
"@cpplint/cli": "^0.1.0",
|
||||||
"@emnapi/runtime": "^1.5.0",
|
"@emnapi/runtime": "^1.5.0",
|
||||||
"@img/sharp-libvips-dev": "1.2.3",
|
"@img/sharp-libvips-dev": "1.2.3",
|
||||||
"@img/sharp-libvips-dev-wasm32": "1.2.3",
|
"@img/sharp-libvips-dev-wasm32": "1.2.3",
|
||||||
@ -175,7 +176,6 @@
|
|||||||
"@img/sharp-libvips-win32-ia32": "1.2.3",
|
"@img/sharp-libvips-win32-ia32": "1.2.3",
|
||||||
"@img/sharp-libvips-win32-x64": "1.2.3",
|
"@img/sharp-libvips-win32-x64": "1.2.3",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"cc": "^3.0.1",
|
|
||||||
"emnapi": "^1.5.0",
|
"emnapi": "^1.5.0",
|
||||||
"exif-reader": "^2.0.2",
|
"exif-reader": "^2.0.2",
|
||||||
"extract-zip": "^2.0.1",
|
"extract-zip": "^2.0.1",
|
||||||
|
|||||||
10
src/CPPLINT.cfg
Normal file
10
src/CPPLINT.cfg
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
set noparent
|
||||||
|
|
||||||
|
linelength=120
|
||||||
|
|
||||||
|
filter=-build/include
|
||||||
|
filter=+build/include_alpha
|
||||||
|
filter=+build/include_subdir
|
||||||
|
filter=+build/include_what_you_use
|
||||||
|
|
||||||
|
filter=-whitespace/indent_namespace
|
||||||
@ -1,18 +1,20 @@
|
|||||||
// Copyright 2013 Lovell Fuller and others.
|
// Copyright 2013 Lovell Fuller and others.
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <string>
|
|
||||||
#include <string.h>
|
|
||||||
#include <vector>
|
|
||||||
#include <queue>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <mutex> // NOLINT(build/c++11)
|
#include <mutex>
|
||||||
|
#include <queue>
|
||||||
|
#include <string>
|
||||||
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <napi.h>
|
#include <napi.h>
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
|
|
||||||
#include "common.h"
|
#include "./common.h"
|
||||||
|
|
||||||
using vips::VImage;
|
using vips::VImage;
|
||||||
|
|
||||||
|
|||||||
@ -4,10 +4,11 @@
|
|||||||
#ifndef SRC_COMMON_H_
|
#ifndef SRC_COMMON_H_
|
||||||
#define SRC_COMMON_H_
|
#define SRC_COMMON_H_
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <atomic>
|
|
||||||
|
|
||||||
#include <napi.h>
|
#include <napi.h>
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
@ -30,7 +31,7 @@ using vips::VImage;
|
|||||||
|
|
||||||
namespace sharp {
|
namespace sharp {
|
||||||
|
|
||||||
struct InputDescriptor { // NOLINT(runtime/indentation_namespace)
|
struct InputDescriptor {
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string file;
|
std::string file;
|
||||||
bool autoOrient;
|
bool autoOrient;
|
||||||
|
|||||||
@ -1,15 +1,17 @@
|
|||||||
// Copyright 2013 Lovell Fuller and others.
|
// Copyright 2013 Lovell Fuller and others.
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
#include <numeric>
|
|
||||||
#include <vector>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <numeric>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <napi.h>
|
#include <napi.h>
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
|
|
||||||
#include "common.h"
|
#include "./common.h"
|
||||||
#include "metadata.h"
|
#include "./metadata.h"
|
||||||
|
|
||||||
static void* readPNGComment(VipsImage *image, const char *field, GValue *value, void *p);
|
static void* readPNGComment(VipsImage *image, const char *field, GValue *value, void *p);
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
#define SRC_METADATA_H_
|
#define SRC_METADATA_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
#include <napi.h>
|
#include <napi.h>
|
||||||
|
|
||||||
#include "./common.h"
|
#include "./common.h"
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
|
|
||||||
#include "common.h"
|
#include "./common.h"
|
||||||
#include "operations.h"
|
#include "./operations.h"
|
||||||
|
|
||||||
using vips::VImage;
|
using vips::VImage;
|
||||||
using vips::VError;
|
using vips::VError;
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
#include <vector>
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
|
|
||||||
using vips::VImage;
|
using vips::VImage;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <filesystem>
|
#include <filesystem> // NOLINT(build/c++17)
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
@ -17,9 +17,9 @@
|
|||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
#include <napi.h>
|
#include <napi.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "./common.h"
|
||||||
#include "operations.h"
|
#include "./operations.h"
|
||||||
#include "pipeline.h"
|
#include "./pipeline.h"
|
||||||
|
|
||||||
class PipelineWorker : public Napi::AsyncWorker {
|
class PipelineWorker : public Napi::AsyncWorker {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <napi.h>
|
#include <napi.h>
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
|
|||||||
12
src/sharp.cc
12
src/sharp.cc
@ -1,16 +1,16 @@
|
|||||||
// Copyright 2013 Lovell Fuller and others.
|
// Copyright 2013 Lovell Fuller and others.
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
#include <mutex> // NOLINT(build/c++11)
|
#include <mutex>
|
||||||
|
|
||||||
#include <napi.h>
|
#include <napi.h>
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
|
|
||||||
#include "common.h"
|
#include "./common.h"
|
||||||
#include "metadata.h"
|
#include "./metadata.h"
|
||||||
#include "pipeline.h"
|
#include "./pipeline.h"
|
||||||
#include "utilities.h"
|
#include "./stats.h"
|
||||||
#include "stats.h"
|
#include "./utilities.h"
|
||||||
|
|
||||||
Napi::Object init(Napi::Env env, Napi::Object exports) {
|
Napi::Object init(Napi::Env env, Napi::Object exports) {
|
||||||
static std::once_flag sharp_vips_init_once;
|
static std::once_flag sharp_vips_init_once;
|
||||||
|
|||||||
@ -1,15 +1,16 @@
|
|||||||
// Copyright 2013 Lovell Fuller and others.
|
// Copyright 2013 Lovell Fuller and others.
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
#include <numeric>
|
|
||||||
#include <vector>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <numeric>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <napi.h>
|
#include <napi.h>
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
|
|
||||||
#include "common.h"
|
#include "./common.h"
|
||||||
#include "stats.h"
|
#include "./stats.h"
|
||||||
|
|
||||||
class StatsWorker : public Napi::AsyncWorker {
|
class StatsWorker : public Napi::AsyncWorker {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
#define SRC_STATS_H_
|
#define SRC_STATS_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
#include <napi.h>
|
#include <napi.h>
|
||||||
|
|
||||||
#include "./common.h"
|
#include "./common.h"
|
||||||
@ -24,7 +25,7 @@ struct ChannelStats {
|
|||||||
|
|
||||||
ChannelStats(int minVal, int maxVal, double sumVal, double squaresSumVal,
|
ChannelStats(int minVal, int maxVal, double sumVal, double squaresSumVal,
|
||||||
double meanVal, double stdevVal, int minXVal, int minYVal, int maxXVal, int maxYVal):
|
double meanVal, double stdevVal, int minXVal, int minYVal, int maxXVal, int maxYVal):
|
||||||
min(minVal), max(maxVal), sum(sumVal), squaresSum(squaresSumVal),
|
min(minVal), max(maxVal), sum(sumVal), squaresSum(squaresSumVal), // NOLINT(build/include_what_you_use)
|
||||||
mean(meanVal), stdev(stdevVal), minX(minXVal), minY(minYVal), maxX(maxXVal), maxY(maxYVal) {}
|
mean(meanVal), stdev(stdevVal), minX(minXVal), minY(minYVal), maxX(maxXVal), maxY(maxYVal) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -2,16 +2,16 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <string>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <napi.h>
|
#include <napi.h>
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
#include <vips/vector.h>
|
#include <vips/vector.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "./common.h"
|
||||||
#include "operations.h"
|
#include "./operations.h"
|
||||||
#include "utilities.h"
|
#include "./utilities.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get and set cache limits
|
Get and set cache limits
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user