Commit Graph

28 Commits

Author SHA1 Message Date
Fabian Boehm
77337fdc8a style.fish: Add rustfmt support 2023-06-01 18:14:12 +02:00
Aaron Gyes
c294c80214 style.fish --all improvements
clang-format (since 10) can output diagnostics which indicate
lines needing formatting with --dry-run and -Werror: the exit
code indicates if a file is correctly formatted or not.

We used to copy each .cpp file, run clang_format on the duplicate
and then `cmp` to see if there were changes made, before just
printing a line with the filename and moving the new ontop of
the original.

Now we show clang-format diagnostics which indicate which
lines will be changed, prompt for confirmation and then let
clang-format modify the files in-place without the juggling.

Looks like this: https://user-images.githubusercontent.com/291142/184561633-c16754c8-179e-426b-ba15-345ba65b9cf9.png
2022-08-14 17:57:36 -07:00
Fabian Boehm
8dbd23372f style.fish: Just ask for uncommitted changes
I keep some files around that I don't *want* to commit or ignore, but
it's fine to restyle them.

It's also fine to restyle everything if you are about to commit
something because then it'll be committed in the correct style.
2022-06-16 18:45:46 +02:00
Johannes Altmanninger
84262b126b build_tools/style.fish: don't format other Python files 2020-12-29 16:31:43 +01:00
Johannes Altmanninger
49c5f96470 Use set -l to force use of a local variable
Bare set overwrites a global/universal variable if it exists.
2020-05-15 08:25:07 +02:00
Fabian Homborg
9367d4ff71 Reindent functions to remove useless quotes
This does not include checks/function.fish because that currently
includes a "; end" in a message that indent would remove, breaking the test.
2020-03-09 19:46:43 +01:00
Jason
3cf6ebc0e1 Amend typos and grammar errors 2019-11-25 13:07:15 +01:00
Fabian Homborg
c2b7e9b2e6 fish_indent: Allow multiple file arguments
Allows `fish_indent -w **.fish` to restyle all fish files under the
current directory.

(This also has the sideeffect of reducing style.fish time by ~10s, as
we only need to invoke `fish_indent` once, instead of once per-file)
2019-05-20 21:04:51 +02:00
Fabian Homborg
4078a3df26 build_tools/style.fish: Stop excluding completions
[ci skip]
2019-05-05 12:54:02 +02:00
Fabian Homborg
df7cb66ff9 build_tools/style: Make output a bit spicier.
COLORS! ALL THE COLORS! Well, three! No, wait, FOUR! But only if you
count "normal" as a color!

[ci skip]
2019-05-05 12:07:38 +02:00
Fabian Homborg
2b3f48d9ee build_tools/style.fish: Use black as python formatter
(Also renames the silly "$f_files" to "$fish_files")
2019-05-05 12:07:38 +02:00
David Adam
a0f785c90f build_tools/style: drop guidance to use make 2019-02-28 22:03:57 +11:00
Fabian Homborg
b75c3b968c Replace muparser with tinyexpr 2018-03-01 13:09:35 +01:00
ridiculousfish
e2b798cda3 [muparser] Restyle muparser sources to match fish
Add muparser soruces to style.fish, and run it to make muparser
match fish style guidelines.
2017-12-18 11:58:13 -08:00
Kurtis Rader
7d65141137 be quiet when make style does nothing
The `make style` and `make style-all` commands have been performing well
without glitches for long enough that it is no longer necessary to report
when they don't change the style of a file. Especially in light of the
fact that all the relevant code has been restyled in the past year. This
change makes `make style-all` much less noisy.
2017-02-22 20:57:15 -08:00
Kurtis Rader
42eaacd3a1 enable make style-all doing fish scripts
I had disabled having `make style-all` restyling fish scripts because a
majority of them did not conform to the style enforced by `fish_indent`.
I recently restyled most of the fish scripts with the exception of the
completion scripts. So this re-enables restyling all scripts with the
exception of completion scripts.
2016-12-03 20:39:32 -08:00
Kurtis Rader
17f5727e7e do not restyle all fish scripts
For now don't restyle all the fish scripts. That's because there
are still problems with the `fish_indent` output that require manual
intervention. Not to mention that very few of the fish scripts even
conform to `fish_indent` output at this time.
2016-10-04 19:48:40 -07:00
ridiculousfish
e1ab6494cd Revert "Improve style script."
This change made clang-format apply to our JavaScript sources,
but we haven't yet agreed upon a JavaScript style guide. Once we
agree on one, we can include the JS files in the formatting pass too.

This reverts commit 799d8ddfc4.
2016-07-24 17:58:56 -07:00
ridiculousfish
5eedb0ee9c Revert "Only show fish greeting for interactive logins"
This reverts commit 3a7a6f16ef.
2016-07-24 16:39:43 -07:00
Aaron Gyes
3a7a6f16ef Only show fish greeting for interactive logins
This is a regression introduced by 834ebef53c
Bolster with a check for only login sessions too -- hopefully makes it
less annooying on subshells in general.

Fixes #3261
2016-07-24 00:05:05 -07:00
Aaron Gyes
799d8ddfc4 Improve style script.
clang-format supports javascript and our 1 obj-c file. Also,
let it pick up a handful of missed files of types we already inteded it
to fix up.

Improve formatting and output.
2016-07-23 05:02:27 -07:00
ridiculousfish
d910aa15fe Avoid using chmod --reference in style.fish
chmod --reference is not available on OS X
Instead, we copy the source file into the temporary path, so that
mode bits are preserved
2016-06-11 15:28:40 -07:00
David Adam
21fc2decd7 lint, style: use git plumbing commands
Rather than using porcelain commands, try using plumbing for a more
stable interface with less string munging.
2016-05-18 23:00:30 +00:00
Kurtis Rader
0d1d324e9f only deal with files that exist
I noticed while working on an unrelated change that deleting a file caused
`make lint` to behave in an unexpected manner.
2016-05-08 12:08:23 -07:00
Kurtis Rader
e1a706bd77 limit make style-all to fish scripts in share
I noticed that if I've previous done `make test` that a subsequent `make
style-all` attempts to restyle all the fish scripts in the *test* directory.
Those files are transient and not part of the git repository. Limit restyling
all fish scripts just to those in the *share* directory tree. There are a
couple elsewhere in the repo (e.g., *build_tools*) but they can be handled on
an individual basis.
2016-05-03 19:37:27 -07:00
Kurtis Rader
df10b53c0c restyle builtin modules to match project style
Now that the IWYU cleanup has been merged compile all, not just a couple, of
the builtin modules independent of builtin.cpp. That is, no longer `#include
builtin_NAME.cpp` in builtin.cpp. This is more consistent, more in line with
what developers expect, and is likely to reduce mistakes.

Reduces lint errors from 384 to 336 (-13%). Line count from 6307 to 4988 (-21%).

Another step in resolving issue #2902.
2016-04-26 21:58:59 -07:00
Kurtis Rader
706bfa70c1 improve the style.fish script
If there are uncommitted changes use `git-clang-format` to limit the style
fixups to the lines being modified.

Refuse to do a `make style-all` if there are uncommitted changes.

Include a fix for the parsing of `git status` output that was recently
incorporated into the lint.fish script.
2016-04-12 19:57:07 -07:00
Kurtis Rader
fd1b7ba529 support making fish code match the style guide
This changes implements two new make targets: `style` and `style-all`. These
make it easy to ensure that a change conforms to the project style guides for
C++ and fish code.

Fixes #571
2016-04-04 21:00:43 -07:00