Code Monkey home page Code Monkey logo

Comments (3)

bartekpacia avatar bartekpacia commented on August 24, 2024

Apparently the difference in behavior is caused by the shell used. bash is used on GitHub Action

My project is named Quiz

bash-5.2$ dotnet tool run xstyler --recursive --file Quiz/**/*.xaml
Processing: Quiz/**/*.xaml
Unhandled exception. System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/bartek/dev/bartekpacia/Quiz/Quiz/**/*.xaml'.
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path)
   at Xavalon.XamlStyler.Console.XamlStylerConsole.TryProcessFile(String file) in /home/vsts/work/1/s/src/XamlStyler.Console/XamlStylerConsole.cs:line 239
   at Xavalon.XamlStyler.Console.XamlStylerConsole.Process(ProcessType processType) in /home/vsts/work/1/s/src/XamlStyler.Console/XamlStylerConsole.cs:line 194
   at Xavalon.XamlStyler.Console.Program.<>c.<Main>b__0_2(CommandLineOptions options) in /home/vsts/work/1/s/src/XamlStyler.Console/Program.cs:line 37
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at Xavalon.XamlStyler.Console.Program.Main(String[] args) in /home/vsts/work/1/s/src/XamlStyler.Console/Program.cs:line 17
bash-5.2$

Yet it works when I don't specify Quiz explicitly:

bash-5.2$ dotnet tool run xstyler --recursive --file **/*.xaml
Processing: Quiz/App.xaml
Processing: Quiz/AppShell.xaml
Processing: Quiz/CreatePage.xaml
Processing: Quiz/MainPage.xaml
Processing: Quiz/PlayPage.xaml

Processed 5 of 5 files.

But it only processed 5 files (not what I want), whereas zsh processed 8 (which is what I want):

zsh-5.9$ dotnet tool run xstyler --recursive --file **/*.xaml
Processing: Quiz/App.xaml
Processing: Quiz/AppShell.xaml
Processing: Quiz/CreatePage.xaml
Processing: Quiz/MainPage.xaml
Processing: Quiz/Platforms/Windows/App.xaml
Processing: Quiz/PlayPage.xaml
Processing: Quiz/Resources/Styles/Colors.xaml
Processing: Quiz/Resources/Styles/Styles.xaml

Processed 8 of 8 files.

Edit

Looks like bash doesn't perform recursive wildcard expansion by default (SO link).

bash-5.2$ shopt -s globstar
bash-5.2$ dotnet tool run xstyler --recursive --file Quiz/**/*.xaml
Processing: Quiz/App.xaml
Processing: Quiz/AppShell.xaml
Processing: Quiz/CreatePage.xaml
Processing: Quiz/MainPage.xaml
Processing: Quiz/Platforms/Windows/App.xaml
Processing: Quiz/PlayPage.xaml
Processing: Quiz/Resources/Styles/Colors.xaml
Processing: Quiz/Resources/Styles/Styles.xaml

Processed 8 of 8 files.

Works fine after enabling it :) Bear in mind that the globstar shell option is supported since Bash v4. The default Bash on macOS is v3.2, and it doesn't have globstar. To install a non-ancient Bash, you can do brew install bash.

from xamlstyler.

bartekpacia avatar bartekpacia commented on August 24, 2024

So, for the future wanderers, if you want to use XamlStyler.Console in your GitHub Actions, you can do the following:

- name: Install non-ancient Bash
  run: brew install bash

- name: Verify XAML code formatting
  shell: bash
  run: |
    shopt -s globstar
    dotnet tool run xstyler --recursive --file Quiz/**/*.xaml --passive

There's probably a way to do a recursive glob in PowerShell v7 but I didn't bother finding it.

from xamlstyler.

bartekpacia avatar bartekpacia commented on August 24, 2024

I'll reopen in case someone finds for PowerShell v7 :)

from xamlstyler.

Related Issues (20)

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.