{"id":15093143,"url":"https://github.com/angular/gulp-clang-format","last_synced_at":"2025-10-06T11:31:26.990Z","repository":{"id":28880737,"uuid":"32405249","full_name":"angular/gulp-clang-format","owner":"angular","description":null,"archived":true,"fork":false,"pushed_at":"2021-08-04T13:57:04.000Z","size":215,"stargazers_count":9,"open_issues_count":2,"forks_count":4,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-05-09T10:10:14.643Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/angular.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-17T16:22:40.000Z","updated_at":"2024-02-26T17:09:31.000Z","dependencies_parsed_at":"2022-07-24T12:02:07.713Z","dependency_job_id":null,"html_url":"https://github.com/angular/gulp-clang-format","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2Fgulp-clang-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2Fgulp-clang-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2Fgulp-clang-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular%2Fgulp-clang-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angular","download_url":"https://codeload.github.com/angular/gulp-clang-format/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219877267,"owners_count":16554853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-25T11:03:50.843Z","updated_at":"2025-10-06T11:31:21.690Z","avatar_url":"https://github.com/angular.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-clang-format [![Build Status](https://github.com/angular/gulp-clang-format/actions/workflows/node.js.yml/badge.svg)](https://github.com/angular/gulp-clang-format/actions/workflows/node.js.yml)\n\nGulp plugin to check that code is properly formatted, according to clang-format.\n\nIf the code differs from how clang-format would format it, this prints a warning\nto the build output, as well as a command to run that formats the file in-place.\n\n## Usage\n\nSample gulpfile.js:\n\n```js\nvar format = require('gulp-clang-format');\n\nvar srcsToFmt = ['path/**/*.js'];\n\ngulp.task('check-format', function() {\n  return gulp.src(srcsToFmt)\n     .pipe(format.checkFormat());\n});\n\ngulp.task('format', function() {\n  // The base option ensures the glob doesn't strip prefixes\n  return gulp.src(srcsToFmt, {base: '.'})\n      .pipe(format.format())\n      .pipe(gulp.dest('.'));\n});\n```\n\n\n### Promoting warnings to errors\nIf you want to enforce the formatting, so that other team members don't introduce\ncode that gives you a warning, you can turn them into build errors by acting on\nthe 'warning' event. For example, this task exits the build immediately:\n\n```js\nvar format = require('gulp-clang-format');\n\ngulp.task('check-format', function() {\n  return gulp.src('*.js')\n      .pipe(format.checkFormat('file'))\n      .on('warning', function(e) {\n        process.stdout.write(e.message);\n        process.exit(1);\n      });\n});\n```\n\n## Options\nThe `format()` and `checkFormat()` both accept two options: `opt_clangStyle` and\n`opt_clangFormat`. `checkFormat()` also accepts a third option,\n`opt_gulpOptions`.\n\n### opt_clangStyle\nAn optional parameter indicating the clang-format style to use. By default, it\napplies the \"Google\" style.\n\nThe parameter is passed to the -style argument of clang-format. See the docs\nhere: http://clang.llvm.org/docs/ClangFormatStyleOptions.html\n\nThe recommended value is the string 'file', this means that clang-format will\nlook for a .clang-format file in your repository. This allows you to keep the\nformatting consistent with other developers.\n\n### opt_clangFormat\nThe resolved `clang-format` module to use. Useful to pass a specific\n`clang-format` version to the task.\n\n```js\nvar format = require('gulp-clang-format');\nvar clangFormat = require('clang-format');\n\ngulp.task('check-format', function() {\n  return gulp.src('*.js')\n      .pipe(format.checkFormat('file', clangFormat));\n});\n```\n\n### opt_gulpOptions\nOptions for the gulp operation. Supported options are\n\n* `verbose`, which causes a diff of all changed files to be printed.\n* `fail`, which causes the task to emit an `error` instead of a `warning`.\n\n```js\nvar format = require('gulp-clang-format');\n\ngulp.task('check-format', function() {\n  return gulp.src('*.js')\n      .pipe(format.checkFormat(undefined, undefined, {verbose: true, fail: true}));\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular%2Fgulp-clang-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangular%2Fgulp-clang-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular%2Fgulp-clang-format/lists"}