Code Monkey home page Code Monkey logo

Comments (11)

nojaf avatar nojaf commented on August 22, 2024 1

GettingStarted.html was out of date indeed, I raised #2857

from fantomas.

nojaf avatar nojaf commented on August 22, 2024

Hello,

Upgrading from version 4.7.9 to 6.0.1 entails two major version bumps, which may introduce breaking changes. Please be aware of this when making the update.

It's worth noting that if you pass a non-existent folder when multiple folders are being passed, the folder will be created as expected.

Mixing versions in your setup seems rather specific on how you choose to do things. You can detect the current version using dotnet fantomas --version and adjust your build script accordingly.

from fantomas.

witoldsz avatar witoldsz commented on August 22, 2024

OK, so I was fooled by official documentation at https://fsprojects.github.io/fantomas/docs/end-users/GettingStarted.html

USAGE: dotnet fantomas [--help] [--recurse] [--force] [--profile] [--fsi ] [--stdin] [--stdout] [--out ] [--check] [--daemon] [--version] []

showing the --recurse is a valid flag. I can see the tool does not show it anymore.

On the other side, I must admit this is very strange to identify the --recurse configuration flag as a directory name (even if it is not a valid flag) and also it is very strange to default to create any non-existing file or directory as a new directory.

Thanks for looking into my case!

from fantomas.

witoldsz avatar witoldsz commented on August 22, 2024

P.S.
It was tricky to remove that directory:

witoldsz@678db1ca1a61:/app/modules/event-logger2$ rmdir --recurse
rmdir: unrecognized option '--recurse'
Try 'rmdir --help' for more information.
witoldsz@678db1ca1a61:/app/modules/event-logger2$ rmdir -- --recurse

It is expected to treat any --something as a flag. Maybe fantomas could follow the rule?

from fantomas.

witoldsz avatar witoldsz commented on August 22, 2024

For whomever it may be useful, my Makefile script works this around like this:

# TODO: upgrade fantomas everywhere and remove this workaround
FANTOMAS = dotnet fantomas `dotnet fantomas --version |grep -q v4.7 && echo --recurse`

check-format: tool-restore
	$(FANTOMAS) --check .

format: tool-restore
	$(FANTOMAS) .

[...]

from fantomas.

MangelMaxime avatar MangelMaxime commented on August 22, 2024

Hello, I often makes mistakes when invoking fantomas and because of that it creates empty directories.

It's worth noting that if you pass a non-existent folder when multiple folders are being passed, the folder will be created as expected.

Why is the expected behaviour to create an empty directory?

If I provide a single non existing directory then it reports it as missing which helps diagnostic the problem.

CleanShot 2023-12-21 at 10 49 13@2x

To me it feels strange to me that a formatting tool create additional files and not just consume only existing files.

from fantomas.

nojaf avatar nojaf commented on August 22, 2024

You could format a directory and output it into a different directory.
If that destination directory does not exist we create it.
Because the source and destination are the same that happens.

from fantomas.

MangelMaxime avatar MangelMaxime commented on August 22, 2024

Sorry, I don't understand do you have a command example?

Looking at the help message:

USAGE: dotnet fantomas [--help] [--force] [--profile] [--out <string>] [--check] [--daemon] [--version] [--verbosity <string>] [<string>...]

INPUT:

    <string>...           Input paths: can be multiple folders or files with *.fs,*.fsi,*.fsx,*.ml,*.mli extension.

OPTIONS:

    --force               Print the output even if it is not valid F# code. For debugging purposes only.
    --profile             Print performance profiling information.
    --out <string>        Give a valid path for files/folders. Files should have .fs, .fsx, .fsi, .ml or .mli extension only. Multiple files/folders are not supported.
    --check               Don't format files, just check if they have changed. Exits with 0 if it's formatted correctly, with 1 if some files need formatting and 99 if there was an
                          internal error
    --daemon              Daemon mode, launches an LSP-like server to can be used by editor tooling.
    --version             Displays the version of Fantomas
    --verbosity, -v <string>
                          Set the verbosity level. Allowed values are n[ormal] and d[etailed].
    --help                display this list of options.

It seems that if I do dotnet fantomas dir1 dir2 then both dir1 dir2 refers to <string>... which is the input paths arguments.

I also tried to use the --out option as I was thinking this is what you are referring to when speaking of a different directory but I was not able to make it works.

dotnet fantomas src --out fantomas fails with

➜  Glutinum.Converter git:(main) ✗ dotnet fantomas --out fantomas src      
                                                              
  Formatted │ 0 │ Ignored │ 0 │ Unchanged │ 0 │ Errored │ 30  
                                                              
Failed to format file: src/Glutinum.Converter/Utils/Keywords.fs
Failed to format file: src/Glutinum.Converter/Utils/Naming.fs
Failed to format file: src/Glutinum.Converter/Utils/String.fs
Failed to format file: src/Glutinum.Converter/Reader/TypeParameters.fs
Failed to format file: src/Glutinum.Converter/Reader/ClassDeclaration.fs
Failed to format file: src/Glutinum.Converter/Reader/Types.fs
Failed to format file: src/Glutinum.Converter/Reader/ModuleDeclaration.fs
Failed to format file: src/Glutinum.Converter/Reader/TypeNode.fs
Failed to format file: src/Glutinum.Converter/Reader/FunctionDeclaration.fs
...

Even if dotnet fantomas src works.

from fantomas.

nojaf avatar nojaf commented on August 22, 2024

I really don't quite remember how it works. This seems to somewhat works for me: dotnet fantomas .\Style\ --out Foobar. Folder Foobar was created and contains the formatted files.
However there is something weird with the output file name.

from fantomas.

dawedawe avatar dawedawe commented on August 22, 2024

See 3024 for a possible fix.

from fantomas.

MangelMaxime avatar MangelMaxime commented on August 22, 2024

I really don't quite remember how it works. This seems to somewhat works for me: dotnet fantomas .\Style\ --out Foobar. Folder Foobar was created and contains the formatted files.
However there is something weird with the output file name.

Ok perhaps, there is something strange in my project

from fantomas.

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.