Skip to Content
Technical Articles
Author's profile photo Fatih Pense

SuperEasy Groovy Syntax Checker for CPI

You change something easy in a Groovy script very quickly and save it, only to find out that you miss a parenthesis! I think this has happened to everyone who codes Groovy scripts.

SuperEasy Groovy Syntax Checker helps you find these small errors and warns you with the line number!

Features

You just continue to use CPI script editor and it shows syntax errors in a box.

What it can find?

  • Missing ‘.’ , ‘+’ or other operators
  • Unmatching number of parentheses
  • String literal errors (these are already obvious with syntax highlighting)
  • Other syntax errors

What it can’t find?

  • Misspelled variable names
  • Using undefined variables or functions
  • Defining a variable multiple times
  • Logic errors

Where it is known to fail?

  • Closures
  • Slashy strings

I tried to make it efficient so you shouldn’t notice any performance issue. For example it only checks the grammar when you stop typing.

It can give false positives as it doesn’t cover the whole Groovy syntax. I think that can be a big research project 🙂
My goal is to make it catch %90 of common problems. You can give feedback if it frequently gives false alarms.

Usage

Let’s start with a clean example.

When I change “as” to “a”:

When I comment “+” at line 12:

Installation

Microsoft Edge(Chromium-based) Extension Install:

Tips & Conclusion

  • It is a good idea to look before the error location. Especially for parentheses errors.
  • If it gives an error where it shouldn’t give and you really need syntax checking for the rest of the script, you can put the problematic code in a function at the bottom so everything else will still be checked.
  • You can move the info box around.

Since I shared GroovyIDE I’m amazed by the feedback I received from the community. Thank you all!

As always I’m open to ideas that make integration consultants’ lives easier. You can comment or write to me directly.

Assigned tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Ramazan Sedat Göç
      Ramazan Sedat Göç

      Hi Fatih,

      I really like your SuperEasy extension. The extension is evolving every week 🙂 And Groovy Syntax Checker would be very useful Groovy developers. Thanks a lot.

      Regards,

      Sedat

      Author's profile photo Fatih Pense
      Fatih Pense
      Blog Post Author

      Hi Sedat,

      Thank you for your kind words and support! I hope to pour more energy to these projects since it seems to be useful to a lot of developers 🙂

      Regards,
      Fatih

      Author's profile photo Syambabu Allu
      Syambabu Allu

      It’s simple and Good tool.

      Thank you for sharing!

      Thank you,

      Syam

      Author's profile photo Fatih Pense
      Fatih Pense
      Blog Post Author

      Thank you Syam! I'm glad it is useful. Feel free to comment if you have any other ideas.

      Regards,
      Fatih