
Walkmod: Open-source tool to automatically apply code conventions - walkmod
http://walkmod.com
======
michaelmior
I find it frustrating that it's not made clear upfront that Walkmod is only
for Java. In fact, it's not really made clear anywhere I can see so I'm not
100% sure that's correct but it seems to be the case.

~~~
smoyer
From their GitHub README [1] (I'm not affiliated):

"Walkmod can support with any programing language if a set of interfaces are
implemented as a third party plugin. The first (and current) supported
language is Java."

[1] [https://github.com/rpau/walkmod-core](https://github.com/rpau/walkmod-
core)

~~~
walkmod
Exactly, Walkmod acts as a framework for language transformations, but we have
started with Java

~~~
speps
It would be nice to write another plugin for something else like Python or
C++. For example in the UML diagram I saw something called "JavadocComment"
which immediately puts me off writing a plugin because it looks like I would
have to follow this even for a non-Java language.

------
bunderbunder
I'm a bit skittish about tools like this.

We started using one for C# a while back, and discovered a couple key problems
with it. First and foremost, sometimes its edits were not safe to do in the
context - either that commented code really was important to keep around for
some specific reason (e.g., it serves an explanatory purpose), or sometimes
the changes were not truly behavior-neutral and would therefore introduce
subtle bugs.

In light of that, I'm moving away from thinking that using tools like this as
a sort of spray-on tan for cleaning up code is wise. I've started leaning
toward the following approach: First, let sleeping dogs lie. Old messy code is
like asbestos; it's most dangerous when you disturb it. Second, if you're
going to have to work on the code anyway then that's an appropriate time to
clean it up. Even so, proceed with caution: Make sure you understand the code
and it's got good test coverage so you can visually and empirically verify
that the cleanup isn't doing any damage.

~~~
walkmod
It is a respectable point of view, but I think that automatize some boring
tasks to correct inside the code is a good idea because let you work on other
more interesting tasks.

In fact, most of us use some automatic ways to correct and enrich code with
IDEs. Is it also incorrect? In fact, what we are trying to solve are the
following situations:

a) In a context where there are a lot of developers and you have worked hard
into improve the code style and someone else pushed code that again violates
your "implicit" code style. Do you need to correct these bad practices over
and over again?

b) There are some boring tasks that punctually appear like "refactoring" when
deprecated methods appear or developers need to upgrade one external library
version (eg. one critical bug appears).

Anyway, thank you for your opinion :-)

------
untog
I think we're long overdue a tool like this (maybe it already exists?) that
will reformat code. I have been so bored beyond tedium about endless debates
over tabs or spaces, 2 spaces or 4 spaces, semi-colons or no semi-colons, etc.
etc. ad nauseum.

Let users check out a repo formatted using whatever indentation they like,
then commit back in a standardised format. Then we can all stop talking about
this utter nonsense and do some real work.

~~~
evolve2k
Thoughtbot offer a tool called HoundCI that does this for JS, ruby,
coffeescript and SASS (SCSS). They charge $12/month for private repos and it's
free for open source.

It's designed to check your github pull requests. Haven't used it but looks
pretty nice. They provide style guides for each language that your free to
customize.

[https://houndci.com](https://houndci.com)

------
srgpqt
Weird name. See also:

[http://astyle.sourceforge.net/](http://astyle.sourceforge.net/)

~~~
walkmod
Walkmod also allows (for Java) to work with the syntanctic and semantic
information. So, for example it can remove unused elements (e.g variables).

------
Joky
For C/C++/ObjC developers, `clang-format` is already a must. I have `git
clang-format` as a pre-commit hook.

------
jellekralt
I prefer to use a tool that gives you feedback on your code, rather than to
correct your code. When you get feedback, you learn and (hopefully), you'll
improve your style while you write your code. When it is automatically
corrected for you, you don't necessarily learn anything from it.

------
sancha_
What happens with the private method and the sysout in your example?

~~~
lowmagnet
Not called so delete I guess. What that has to do with style or conventions I
don't know.

~~~
walkmod
Yes, what I wanted to show in this example is that those elements that are
"dead" can be removed (there is a plugin for it)

~~~
tobik
Ok, so the commented out for loop in the example is also considered "dead".
Walkmod detects that it is in fact commented out code and only then removes
it. Correct?

~~~
walkmod
Yes, but in contrast with removing unused private methods, currently there is
no walkmod plugin that do this yet. We are working on adding more plugins.

------
daskills225
I like tools like this, but why not just write good code in the first place
and make people fix code they write poorly?

~~~
Quequau
If that actually worked it would already be happening... but honestly it
isn't.

------
hadeharian
Every problem in computer science can be solved by another level of
indirection. Genius! Genius! Genius!

------
kyled
Php-cs-fixer is another example. It does some ridiculous changes though, such
as change $i++ to ++$i.

------
_ZeD_
umm... but eclipse already do this...

~~~
malka
Yes, but this could be used as a hook after a push on the git, so that code
would always follow a certain convention, whatever editor the developper that
pushed used.

~~~
walkmod
Exactly :-) Moreover, it is useful for open source projects where developers
use different editors

