diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..1516991 --- /dev/null +++ b/.clang-format @@ -0,0 +1,2 @@ +BasedOnStyle: Google +ColumnLimit: 90 diff --git a/.clang-format-ignore b/.clang-format-ignore new file mode 100644 index 0000000..f3e13d6 --- /dev/null +++ b/.clang-format-ignore @@ -0,0 +1,15 @@ +# dependencies +node_modules + +# production +build +.next + +# env +.env +.env.development +.env.production + +# tests +.nyc_output +coverage diff --git a/.prettierignore b/.prettierignore index 76ef5c8..c83e239 100644 --- a/.prettierignore +++ b/.prettierignore @@ -19,3 +19,7 @@ package-lock.json # markdown *.md + +# cpp +*.c +*.cpp diff --git a/.vscode/settings.json b/.vscode/settings.json index 5c662ff..d4c380d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,10 +2,14 @@ "editor.formatOnSave": true, "editor.formatOnPaste": true, "editor.defaultFormatter": "esbenp.prettier-vscode", + "[c][cpp]": { + "editor.defaultFormatter": "ms-vscode.cpptools" + }, "editor.codeActionsOnSave": { "source.fixAll.eslint": "always", "source.fixAll.stylelint": "always", "source.fixAll.markdownlint": "always" }, - "stylelint.validate": ["css", "scss"] + "stylelint.validate": ["css", "scss"], + "C_Cpp.clang_format_fallbackStyle": "Google" } diff --git a/package-lock.json b/package-lock.json index ae9a1cd..a45a33f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "web-blog", + "name": "web-blog.lumir.page", "lockfileVersion": 3, "requires": true, "packages": { @@ -13,6 +13,7 @@ "react-dom": "^18.3.1" }, "devDependencies": { + "clang-format-node": "^1.0.2", "concurrently": "^8.2.2", "editorconfig-checker": "^5.1.8", "eslint": "^8.57.0", @@ -1956,6 +1957,17 @@ "node": ">= 6" } }, + "node_modules/clang-format-node": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clang-format-node/-/clang-format-node-1.0.2.tgz", + "integrity": "sha512-wi2qBA5Ixk75PpUIpRMZS1k84IOKu339Fai86yG6CjIzHndUyrdhCRB1cOTyDHmcXIW5BOzLGljqskEOjv0USw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "clang-format": "build/index.js" + } + }, "node_modules/cli-cursor": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", diff --git a/package.json b/package.json index 9786478..f0b1688 100644 --- a/package.json +++ b/package.json @@ -12,10 +12,12 @@ "lint-editorconfig": "npx editorconfig-checker", "lint-markdownlint": "npx markdownlint **/*.md", "lint-textlint": "npx textlint -f pretty-error src/docs", + "lint-clangformat": "find . -name '*.c' -o -name '*.cpp' -print0 | xargs -0 npx clang-format -n -Werror", "fix": "concurrently \"npm:fix-*\"", "fix-eslint": "npx eslint . --fix --ext .js,.jsx", "fix-stylelint": "npx stylelint --fix **/*.{css,scss}", "fix-prettier": "npx prettier . --write", + "fix-clangformat": "find . -name '*.c' -o -name '*.cpp' -print0 | xargs -0 npx clang-format -i", "count-docs": "ls -R src/docs | grep .md | wc -l" }, "dependencies": { @@ -27,6 +29,7 @@ "react-dom": "^18.3.1" }, "devDependencies": { + "clang-format-node": "^1.0.2", "concurrently": "^8.2.2", "editorconfig-checker": "^5.1.8", "eslint": "^8.57.0", @@ -51,6 +54,7 @@ "*.{js,jsx}": "npx eslint", "*.{css,scss}": "npx stylelint", "*.md": "npx markdownlint", - "src/docs/**/*.md": "npx textlint -f pretty-error" + "src/docs/**/*.md": "npx textlint -f pretty-error", + "*.{c,cpp}": "npx clang-format -n -Werror" } } diff --git a/public/code/ps/baekjoon/2558.c b/public/code/ps/baekjoon/2558.c new file mode 100644 index 0000000..c659a95 --- /dev/null +++ b/public/code/ps/baekjoon/2558.c @@ -0,0 +1,10 @@ +#include + +int main(int argc, char* argv[]) { + int a = 0, b = 0; + + scanf("%d %d", &a, &b); + printf("%d", a + b); + + return 0; +}