Giter Site home page Giter Site logo

jcam / mule-lint Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mule-lint/mule-lint

0.0 1.0 0.0 273 KB

Scans through Mule XML code and provides reporting based on what is found, is heavily driven by user's own rules.

Home Page: https://mule-lint.github.io/

License: MIT License

Groovy 99.90% Shell 0.10%

mule-lint's Introduction

Mule Lint Project

We believe building some types of software are not trivial and when there are many applications, it is a good thing to make sure you have some consistency around certain pieces of software. Primarily that logging follows a very strict convention for your organization or project. So having some analysis across all your systems would be a good thing. That is how this started.

We need a way to check on what log categories we have, and how well our structured (or lack of following the structured format) was occurring across our entire code base.

I would like different information about Mule code. What http:request does not have a Content-Type or User-Agent defined? What logger’s do not have a category or “transactionId” in the message? What flows are sync or async? I’m thinking more information about the code base. A static analysis.

For the initial releases of this project, this will be information giving, not enforcing. A report will be provided with the findings that can be used for historical keeping, but could also be used by other pieces in your pipeline to assert a value/count does not exceed a threshold you define.

Such as find regex within loggers message attribute (or category attribute)

Or does does attribute X have values within this acceptable list?

We also come across where certain elements needed to configured a certain way, and often devs, by mistake or otherwise, would change these attributes. So this is intended to provide that safety net, that what we end up deploying out satisfies a certain criteria.

The main purpose goal of this project is to detect code differences that will impact functional operations. An initial list of items we would like to check are:

  • Does every http:request have a User-Agent defined?
  • Does every http:request have a (context specific) X-\* header defined?
  • Does every logger have a category that is known?
  • (Longer term goal) What logger does not follow our team defined structured logging format?
  • Do we have any logger that references #[payload]
  • Do we have any logger that does not reference (context specific) transactionId?

Initial Rule Format

There are quite a few things we want to do, but to get out a MVP we are trying to find something that is easier for us to deliver, then to improve upon later.

This is what we are working towards for a rules.groovy example:

version '0.0.1'

flow are camel cased

element 'logger' hasAttribute 'category'

element 'logger' hasParent 'until-successful'

element 'http:request' hasChild 'User-Agent'

element 'http:request' hasChild 'http:header' withAttribute 'headerName' havingValue 'User-Agent' withAttribute 'value' havingValue 'my-bot-name 1.0'

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Maven

If you are just wanting to use this with a Maven build, then please refer to mule-lint-maven-plugin project which provides a much easier way of invocation rather than calling this project directly.

Example Project

We have put together a trivial Mule app that we will keep up-to-date to reflect new features of mule-lint. You can find it on Github.

Prerequisites

Java8 is required, there are known issues with anything greater than Java8.

Versions up to 0.4.0 were built with Gradle 4.1-rc-1 (the repo includes its own ./gradlew).

Versions 0.5.0 and above were built with Gradle 5.

$ git clone [email protected]:mule-lint/mule-lint.git
$ cd mule-lint
$ ./gradlew build

Running the tests

All tests are ran using Gradle. There are no category of tests (i.e. unit tests or integration tests), everything is packaged together under src/test/groovy. Starting with version 0.5.0 we use JUnit5 (Jupiter tests)

$ ./gradlew build

Built With

  • Java - Java8 is required, there are known issues with anything greater than Java8.
  • Gradle - Build system, please use the wrapper within the repo ./gradlew
  • Groovy - Written in Groovy using the version that Mule depends upon as well. Currently v2.4.4

The following is what MuleSoft recommends for the different versions of Mule.

4.1.4 JDK 1.8.0 (Recommended JDK 1.8.0_171/72)
4.1.0 JDK 1.8.0 (Recommended JDK 1.8.0_151/52)
3.9.2 Oracle JDK 1.8.0 (Recommended JDK 1.8.0_191/192), IBM JDK 1.8, OpenJDK 8
3.9.1 Oracle JDK 1.8.0 (Recommended JDK 1.8.0_151/52), IBM JDK 1.8, OpenJDK 8
3.9.0 JDK 1.8.0 (Recommended JDK 1.8.0_144)

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

If you are interested in the DSL used then give the docs a read, they are a great starting point.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

  • Hat tip to PurpleBooth as she provided the starting point of this README and other project related files.

mule-lint's People

Contributors

cgorshing avatar kmillerjr avatar

Watchers

 avatar

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.