Giter Site home page Giter Site logo

ksheffield3 / codemetrics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kisstkondoros/codemetrics

0.0 2.0 0.0 134 KB

VSCode extension which shows the complexity information for TypeScript class members

License: Other

JavaScript 1.47% TypeScript 98.53%

codemetrics's Introduction

Code Metrics - Visual Studio Code Extension

Computes complexity in TypeScript / JavaScript files.

It looks like this

First sample, demonstrating a constructor with overall complexity of 21

Second sample, demonstrating a constructor with overall complexity of 1

Third sample, demonstrating a method with overall complexity of 5

Install

How to install Visual Studio Code extensions

Direct link to Visual Studio Code Marketplace

Customization

In the workspace settings one can override the defaults (for a complete list check AppConfiguration.ts)

{
  // highest complexity level will be set when it exeeds 15
  "codemetrics.basics.ComplexityLevelExtreme" : 15,

  // Hides code lenses with complexity lesser than the given value
  "codemetrics.basics.CodeLensHiddenUnder" : 5,

  // Description for the highest complexity level
  "codemetrics.basics.ComplexityLevelExtremeDescription" : "OMG split this up!",

  // someone uses 'any', it must be punished
  "codemetrics.nodeconfiguration.AnyKeyword": 100
}

Commands

  • Toggle code lenses for arrow functions
  • Toggle code metrics

They can be bound in the keybindings.json (File -> Preferences -> Keyboard Shortcuts)

{ "key": "f4",                    "command": "codemetrics.toggleCodeMetricsForArrowFunctions",
                                     "when": "editorTextFocus" },
{ "key": "f5",                    "command": "codemetrics.toggleCodeMetricsDisplayed",
                                     "when": "editorTextFocus" }

Change Log

  • 1.9.3
    • Update readme
  • 1.9.2
    • Fix behavior of command 'codemetrics.toggleCodeMetricsForArrowFunctions'
  • 1.9.1
    • Set default of ObjectLiteralExpression to 0
  • 1.9.0
    • Implement file exclusion by glob pattern
  • 1.8.0
    • Upgrade to [email protected]
    • Use new collector types from tsmetrics-core (show complexity maximum on class level)
  • 1.7.2
    • Make it possible to enable / disable diagnostics
  • 1.7.1
    • Always use activeTextEditor in change callbacks
  • 1.7.0
    • Add experimental diagnostics support
    • Add experimental support for Lua
  • 1.6.1
    • Fix spelling error of 'threshold' in configuration
  • 1.6.0
    • Execute code metrics computation in language server
  • 1.5.0
    • Upgrade vsdcode and typescript dependency
    • Remove unused typings
    • Extract code metrics related util class
    • Move CodeMetricsCodeLensProvider to codelensprovider folder
    • Add text decoration based on code metrics
      • Appearance can be configured with the following properties:
        • "codemetrics.basics.DecorationModeEnabled"
        • "codemetrics.basics.CodeLensEnabled"
  • 1.4.1
    • Update changelog
  • 1.4.0
    • Expose code lens location related configuration properties
      • "codemetrics.basics.MetricsForClassDeclarationsToggled"
      • "codemetrics.basics.MetricsForConstructorsToggled"
      • "codemetrics.basics.MetricsForEnumDeclarationsToggled"
      • "codemetrics.basics.MetricsForFunctionDeclarationsToggled"
      • "codemetrics.basics.MetricsForFunctionExpressionsToggled"
      • "codemetrics.basics.MetricsForMethodDeclarationsToggled"
      • "codemetrics.basics.MetricsForArrowFunctionsToggled"
  • 1.3.0
    • Add new properties to selectively disable codemetrics for different languages
      • "codemetrics.basics.EnabledForTSX"
      • "codemetrics.basics.EnabledForJSX"
      • "codemetrics.basics.EnabledForTS"
      • "codemetrics.basics.EnabledForJS"
    • Introduce file size limit
      • "codemetrics.basics.FileSizeLimitMB" default is 0.5 MB
  • 1.2.2
    • Fix behaviour of CodeLensHiddenUnder
  • 1.2.1
    • Change type of IfWithElseStatement property to number
  • 1.2.0
    • Add JSX and TSX support, special thanks to Aron Adler
  • 1.1.6
    • Fix possible NPE in 'triggerCodeLensComputation'
    • Remove language restriction from 'activationEvents'
  • 1.1.5
    • Udpate logo
  • 1.1.4
    • Change textual representation in quick pick
  • 1.1.3
    • Fix typo in codemetrics.basics.ComplexityLevelNormalDescription
  • 1.1.2
    • Fix dependency issue with 'fs'
  • 1.1.1
    • Fix issue with non up to date source file processing
  • 1.1.0
    • Parse logic refactored to be a separate npm module tsmetrics-core allowing to create a gulp plugin as well gulp-tsmetrics
    • QuickPick now works with a simplified and more meaningful list, which shows only one level of the hierarchy at once
  • 1.0.1
    • Default keyboard bindings removed
    • CodeLens cache invalidation side effect eliminated (dirty file)
    • Path concatenation replaced with path.join
  • 1.0.0
    • Configuration properties has been renamed and listed in extension manifest
    • New property CodeLensHiddenUnder introduced to be able to hide uninteresting code lenses
  • 0.5.0
    • Commands to alter code metrics behaviour added (toggle code metrics and toggle code lenses for arrow functions)
  • 0.4.1
    • Showing complexity for arrow functions as well
  • 0.4.0
    • Added JavaScript support
    • Removed module declaration from the complexity calculation
    • Function related complexity calculation revised
  • 0.3.1
    • Fixed NPE in navigation command
  • 0.3.0
    • Use script target defined in tsconfig
  • 0.2.0
    • Code Metrics info command changed to display a QuickPick menu
  • 0.1.0
    • Added command to be able to show code lens details
  • 0.0.2
    • TypeScript added as real dependency
  • 0.0.1
    • Initial project setup

License

Licensed under MIT

codemetrics's People

Contributors

kisstkondoros avatar arrow7000 avatar pbounaix avatar

Watchers

 avatar James Cloos avatar

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.