Giter Club home page Giter Club logo

cloc-vsts-extension's Introduction

Count Lines of Code Build Task

A build task for Visual Studio Team Services (VSTS) made with ♥ by

dealogic logo

to count your lines of code.

build status

Content

Installation

Installation can be done using Visual Studio MarketPlace.

Source Code

Source code can be found on GitHub.

What The Build Step Does

This build step is counting your lines of code with using the cloc CLI. The result is reported as a section on the build summary page.

Result is reported on the build summary page

Usage

Add the task to your build configuration:

Add Count Line of Code task

Arguments have to be specified:

Specify the arguments for the cloc CLI

By default the cloc CLI is running in the root of the repository, you can modify that in the advanced settings as the working folder task parameter:

Working folder is the path, where the cloc CLI will run

By default the cloc CLI is downloaded from the url: https://github.com/AlDanial/cloc/releases/download/1.82/cloc-1.82.exe:

The download URL of the cloc-cli tool

But now file shares and local files are supported to such as:

file://my-file-share/public/software/cloc-1.82.exe

or

./cloc.1.82.exe

Release Notes

  • 1.2.1 (19/06/2019)
    • New build/deployment badge on README page. (as build and deployment are on travis-ci.org)
    • File URLs are supported such as file://my-file-share/public/software/cloc-1.82.exe or local file path as ./cloc.1.82.exe
  • 1.1.2 (13/12/2018)
    • Display name of the task will be used as title for the summary on build summary page
    • Option to modify the cloc-cli download URL
  • 1.0.0 (14/08/2017)
    • Counting lines of code with cloc CLI (by Al Danial)
    • Result of the cloc CLI is reported onto the Build Summary page
    • Custom arguments can be provided to the build task, to the cloc CLI
    • Working folder can be modified where the cloc CLI will run

License

MIT

cloc-vsts-extension's People

Contributors

jkanczler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cloc-vsts-extension's Issues

Can't find cloc.exe

I've added cloc as a step in my build pipeline. It downloads successfully and then fails because it can't locate cloc.exe...

2019-01-15T19:04:11.9575687Z ##[section]Starting: Count lines of code...
2019-01-15T19:04:11.9579353Z ==============================================================================
2019-01-15T19:04:11.9579442Z Task : Count Lines of Code
2019-01-15T19:04:11.9579482Z Description : Count Lines of Code with cloc CLI by Al Danial.
2019-01-15T19:04:11.9579522Z Version : 1.1.2
2019-01-15T19:04:11.9579582Z Author : Dealogic
2019-01-15T19:04:11.9579621Z Help : More information cloc
2019-01-15T19:04:11.9579661Z ==============================================================================
2019-01-15T19:04:12.3336825Z task display name: Count lines of code...
2019-01-15T19:04:12.3346536Z working folder: D:\a\1\s
2019-01-15T19:04:12.3356697Z cloc-cli download url: https://github.com/AlDanial/cloc/releases/download/1.80/cloc-1.80.exe
2019-01-15T19:04:12.3358026Z arguments: --exclude-dir=.gitignore --exclude-ext=.md
2019-01-15T19:04:12.3368795Z Downloading cloc.exe from 'https://github.com/AlDanial/cloc/releases/download/1.80/cloc-1.80.exe'
2019-01-15T19:04:13.6897941Z Download is completed.
2019-01-15T19:04:13.6898354Z Executing command: cloc.exe --exclude-dir=.gitignore --exclude-ext=.md --sum-one --md --out cloc.result.md
2019-01-15T19:04:16.8508360Z ##[error]Unhandled: Command failed: cloc.exe --exclude-dir=.gitignore --exclude-ext=.md --sum-one --md --out cloc.result.md

                   cloc -- Count Lines of Code

Usage:
cloc.exe [options] <file(s)/dir(s)/git hash(es)>
Count physical lines of source code and comments in the given files
(may be archives such as compressed tarballs or zip files) and/or
recursively below the given directories or git commit hashes.
Example: cloc src/ include/ main.c

cloc.exe [options] --diff <set1>  <set2>
    Compute differences of physical lines of source code and comments
    between any pairwise combination of directory names, archive
    files or git commit hashes.
    Example:    cloc --diff Python-3.5.tar.xz python-3.6/

cloc.exe --help shows full documentation on the options.
http://github.com/AlDanial/cloc has numerous examples and more information.

The Name Contains Invalid Characters Error while uploading result file via cloc plugin in Azure DevOps

Hi,

I am using the Count Lines of Code plugin in my azure devops pipeline to count the lines for my javascript source code, however the tasks fails while uploading the file with below error.

Uploading result file from e:\cache\Agent03\11\s\cloc.result.md
##[error]Unable to process command '##vso[task.addattachment type=Distributedtask.Core.Summary;name=cloc e:\cache\Agent03\11\s\PSP.Web.UI\app\scripts\;]e:\cache\Agent03\11\s\cloc.result.md' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
##[error]Name contains invalid characters. (", <, >, |, , �, �, �, �, �, �, �, �, 	, 

Attaching the screenshot of the values provided in the plugin for references, I want this plugin to display the result on the build summary.
I also noticed that this task by default creates the result in cloc.result.md file. I tried passing arguments explicitly by different file names but it still took the same file name.

Can you please guide me how can I resolve this error?
image

image

TypeError: fs.copyFile is not a function

TFS 2018 on Windows Server with node.js Latest LTS Version: 12.18.3 (includes npm 6.14.6):

2020-07-22T23:12:09.8281274Z task display name: cloc --windows .
2020-07-22T23:12:09.8286442Z working folder: C:\Msft_test\AgentSmith_work\1\s
2020-07-22T23:12:09.8344899Z cloc-cli download url: file://C:/cloc/cloc-1.86.exe
2020-07-22T23:12:09.8345511Z arguments: --windows .
2020-07-22T23:12:09.8345591Z Downloading cloc.exe from:
2020-07-22T23:12:09.8345752Z Url {
2020-07-22T23:12:09.8345822Z protocol: 'file:',
2020-07-22T23:12:09.8345890Z slashes: true,
2020-07-22T23:12:09.8345973Z auth: null,
2020-07-22T23:12:09.8346037Z host: 'c',
2020-07-22T23:12:09.8346101Z port: null,
2020-07-22T23:12:09.8346166Z hostname: 'c',
2020-07-22T23:12:09.8346493Z hash: null,
2020-07-22T23:12:09.8346560Z search: null,
2020-07-22T23:12:09.8346624Z query: null,
2020-07-22T23:12:09.8346711Z pathname: '/cloc/cloc-1.86.exe',
2020-07-22T23:12:09.8346785Z path: '/cloc/cloc-1.86.exe',
2020-07-22T23:12:09.8346858Z href: 'file://c/cloc/cloc-1.86.exe' }
2020-07-22T23:12:09.8346939Z Copying file from '//c/cloc/cloc-1.86.exe'
2020-07-22T23:12:09.8383559Z ##[error]cloc --windows . failed
2020-07-22T23:12:09.8403635Z ##[error]TypeError: fs.copyFile is not a function
2020-07-22T23:12:09.8403837Z TypeError: fs.copyFile is not a function
2020-07-22T23:12:09.8403946Z at Object.downloadClocCli [as default] (C:\Msft_test\AgentSmith_work_tasks\cloc_7b598338-cf0d-4c3f-acc2-4967b6202533\1.2.1\clocCliDownloader.js:16:20)
2020-07-22T23:12:09.8404106Z at C:\Msft_test\AgentSmith_work_tasks\cloc_7b598338-cf0d-4c3f-acc2-4967b6202533\1.2.1\index.js:33:40
2020-07-22T23:12:09.8404193Z at next (native)
2020-07-22T23:12:09.8404295Z at C:\Msft_test\AgentSmith_work_tasks\cloc_7b598338-cf0d-4c3f-acc2-4967b6202533\1.2.1\index.js:7:71
2020-07-22T23:12:09.8404401Z at __awaiter (C:\Msft_test\AgentSmith_work_tasks\cloc_7b598338-cf0d-4c3f-acc2-4967b6202533\1.2.1\index.js:3:12)
2020-07-22T23:12:09.8404530Z at run (C:\Msft_test\AgentSmith_work_tasks\cloc_7b598338-cf0d-4c3f-acc2-4967b6202533\1.2.1\index.js:15:12)
2020-07-22T23:12:09.8404642Z at Object. (C:\Msft_test\AgentSmith_work_tasks\cloc_7b598338-cf0d-4c3f-acc2-4967b6202533\1.2.1\index.js:47:1)
2020-07-22T23:12:09.8404751Z at Module._compile (module.js:570:32)
2020-07-22T23:12:09.8404831Z at Object.Module._extensions..js (module.js:579:10)
2020-07-22T23:12:09.8404918Z at Module.load (module.js:487:32)

Git Link Changed

The cloc git download link was updated from .../download/vX.X/... to .../download/X.X/... Please correct the download script to account for this change as it causes the build step to fail. Manually changing the script in each task cache temporarily resolves the issue, but it would be great if that change could be applied to the task in the marketplace.

Will not install in VS 2017 V15.7.3

From the log:
6/3/2018 8:57:44 PM - Microsoft VSIX Installer
6/3/2018 8:57:44 PM - -------------------------------------------
6/3/2018 8:57:44 PM - vsixinstaller.exe version:
6/3/2018 8:57:44 PM - 15.7.105+ga2c5d563c6
6/3/2018 8:57:44 PM - -------------------------------------------
6/3/2018 8:57:44 PM - Command line parameters:
6/3/2018 8:57:44 PM - C:\program files (x86)\microsoft visual studio\installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\Users\rpeaugh\Downloads\Chrome\Dealogic.cloc-vsts-extension-1.0.0 (2).vsix
6/3/2018 8:57:44 PM - -------------------------------------------
6/3/2018 8:57:44 PM - Microsoft VSIX Installer
6/3/2018 8:57:44 PM - -------------------------------------------
6/3/2018 8:57:44 PM - Initializing Install...
6/3/2018 8:57:44 PM - Extension Details...
6/3/2018 8:57:44 PM - Identifier : cloc-vsts-extension
6/3/2018 8:57:44 PM - Name : Count Lines of Code
6/3/2018 8:57:44 PM - Author : Dealogic
6/3/2018 8:57:44 PM - Version : 1.0.0
6/3/2018 8:57:44 PM - Description : Count Lines of Code with cloc CLI by Al Danial.
6/3/2018 8:57:44 PM - Locale : en-US
6/3/2018 8:57:44 PM - MoreInfoURL :
6/3/2018 8:57:44 PM - InstalledByMSI : False
6/3/2018 8:57:44 PM - SupportedFrameworkVersionRange : [0.0,2147483647.2147483647]
6/3/2018 8:57:44 PM -
6/3/2018 8:57:44 PM - SignatureState : Unsigned
6/3/2018 8:57:44 PM - Supported Products :
6/3/2018 8:57:44 PM - Microsoft.VisualStudio.Services
6/3/2018 8:57:44 PM - Version :
6/3/2018 8:57:44 PM -
6/3/2018 8:57:44 PM - References :
6/3/2018 8:57:44 PM - Signature Details...
6/3/2018 8:57:44 PM - Extension is not signed.
6/3/2018 8:57:44 PM -
6/3/2018 8:57:44 PM - Searching for applicable products...
6/3/2018 8:57:44 PM - Found installed product - Global Location
6/3/2018 8:57:44 PM - Found installed product - Visual Studio Professional 2017
6/3/2018 8:57:44 PM - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
at VSIXInstaller.App.GetInstallableData(String vsixPath, Boolean isRepairSupported, IEnumerable1& skuData) at VSIXInstaller.App.Initialize(Boolean isRepairSupported) at VSIXInstaller.App.Initialize() at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Request: Please add an option for a title

If you have multiple "cloc" tasks, you don't know which one belongs to what. Having a title option would allow to see it in the summary.

To do it, simply add a new ## line on top of the cloc.result.md with the wished title

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.