Code Monkey home page Code Monkey logo

pscodeanalyzer's People

Contributors

altrive avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

c0ns0le

pscodeanalyzer's Issues

Escaped space characters is not retained after code formatting

Escaped space characters is not retained after code formatting operation.

Example

#Before format
"1" + `   + "1"
#After format
"1" + + "1"

PowerShell buildin tokenizer doesn't return escaped space characters(` ).
If this problem cause wrong formatting result case, it may need to fixed.

ISE editor crash is some condition

ISE randomly crashed when Ctrl+K,Ctrl+D formatting.
There seems to be exist some text pattern that cause this problem.
but it can't reproduce in unit test environment, only occures ISE environment.

Error occurs when code contains PSv4 DynamicKeyword statements

User defined DynamicKeyword token is not recognized appropriately after code formatting.

#Requires -Version 4.0
Set-StrictMode -Version Latest

#Reset Existing Dynamic Keywords
[Management.Automation.Language.DynamicKeyword]::Reset()

#Add Dynamic Keyword
$keyword = New-Object System.Management.Automation.Language.DynamicKeyword
$keyword.Keyword = "requires"
$keyword.BodyMode = [Management.Automation.Language.DynamicKeywordBodyMode]::ScriptBlock
$keyword.NameMode = [Management.Automation.Language.DynamicKeywordNameMode]::NoName

[System.Management.Automation.Language.DynamicKeyword]::AddKeyword($keyword)

function Test
{
    param (
        $aaa,
        $bbb
    )
    $ccc = "ccc"
    requires
    {
        1 | should be 1
        1 | should be 2
    }
}

function requires
{
    param (
        [Management.Automation.Language.DynamicKeyword] $KeywordData,
        $Name,
        [ScriptBlock] $Value,
        $SourceMetaData,
        $InstanceName
    )
    #$PSBoundParameters
    $ErrorActionPreference = "Stop"
    try
    {
        return & $Value #Execute ScriptBlock
    }
    catch
    {
        Write-Host ("Error Line: {0}" -f $vvv.InvocationInfo.Line.Trim())

    }
}

Test

Error when multiline comment exists between expressions

Executing formatting following statement throw errors.

$(1..100)<##>.<##>Where({ $_ % 4 -eq 0 })
Format code operation failed! Please report following error context information
---------------------------------------
Line: Before -> After
$(1..100)<##>.<##>Where({ $_ % 4 -eq 0 })
$(1..100) <##>.<##>Where({ $_ % 4 -eq 0 })
---------------------------------------

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.