Giter Club home page Giter Club logo

alizer's Introduction

Alizer

Build status Release Nightly

Overview

Alizer (which stands for Application Analyzer) is a utilily whose goal is to extract informations about an application source code. Such informations are:

  • source languages
  • frameworks used inside the application
  • tools used to build the application

Also based on these informations, Alizer can also select one devfile (cloud workspace file) from a list of available devfiles and/or detect components (the concept of component is taken from Odo and its definition can be read on odo.dev).

Alizer comes in 4 different implementations:

  • Java library
  • CLI
  • NPM package
  • Go library

so that it can be integrated easily in other projects.

NOTE: Not all implementations support the same features. Please check the table at alizer-spec for a detailed overview.

Usage

Information

First, get access to the Alizer API through a LanguageRecognizer object which can be built like that:

LanguageRecognizer recognizer = new RecognizerFactory().createLanguageRecognizer();

Then, access the project information with the analyze method:

List<Language> languages = recognizer.analyze("myproject");

The result is an ordered list of information for each language detected in the source tree, with the following informations:

  • name: the name of the detected language
  • framework: a list of detected frameworks (Quarkus, Flash,...) used by the application
  • tools: a list of tools (Maven,...) used by the application
  • weight: a double value that represents the language weight compared to the others.

NOTE: the sum of all weights can be over 100 because a file may be associated to multiple languages and Alizer may not be able to detect it precisely. E.g. a SQL script could be associated to SPLPL, TSQL, PLSQL languages so Alizer will return all 3 with the same weight.

Devfile selection

It is also possible to select a devfile from a list of existing devfiles (from a devfile registry or other storage) based on the information that we can now extract from the source tree:

DevfileType devfile = recognizer.selectDevFileFromTypes("myproject", devfiles)

where devfiles is a list of objects implementing the DevfileType interface which defines the following properties:

  • name: name of the devfile
  • language: name of the language associated with the devfile
  • projectType: type of project associated with the devfile
  • tags: list of tags associated with the devfile

Please note that the devfile object that is returned by the method is one of the object from the list of devfiles given in input for better matching for the user.

Component detection

Alizer is also able to detect components. The concept of component is taken from Odo and its definition can be read on odo.dev.

The detection of a component is based on two rules. It is discovered if and only if:

  1. The main language of the component source is one of those that supports component detection (Java, Python, Javascript, Go)
  2. The source has at least one framework

The result is a list of components where each component consists of:

  • path: root of the component
  • languages: list of languages belonging to the component ordered by their relevance.
ComponentRecognizer recognizer = new RecognizerFactory().createComponentRecognizer();
List<Component> components = recognizer.analyze("myproject");

CLI

Alizer is also available through a CLI for applications that can't use the Java API. The syntax is the following:

alizer-cli-$version-runner analyze [-o json] <path>
alizer-cli-$version-runner devfile [-o json] [-r registry-url] <path>

NPM Package

Alizer also offers a NPM package providing helpers for recognize languages/frameworks in a project. It still doesn't support devfile selection. The syntax is the following:

import * as recognizer from '@redhat-developer/alizer';

.....

const languages = await recognizer.detectLanguages('my_project_folder');

.....

Outputs

Quarkus project output example

[
  { name: 'java', builder: 'maven', frameworks: [ 'quarkus' ] },
  { name: 'gcc machine description' }
]

SpringBoot project output example

[
  { name: 'java', builder: 'maven', frameworks: [ 'springboot' ] },
  { name: 'plsql' },
  { name: 'plpgsql' },
  { name: 'sqlpl' },
  { name: 'tsql' },
  { name: 'javascript' },
  { name: 'batchfile' },
  { name: 'gcc machine description' }
]

Django project output example

[
  { name: 'python', frameworks: [ 'django' ] },
  { name: 'gcc machine description' },
  { name: 'shell' }
]

Contributing

This is an open source project open to anyone. This project welcomes contributions and suggestions!

For information on getting started, refer to the CONTRIBUTING instructions.

Feedback & Questions

If you discover an issue please file a bug and we will fix it as soon as possible.

License

EPL 2.0, See LICENSE for more information.

alizer's People

Contributors

evidolob avatar fbricon avatar jeffmaury avatar jerolimov avatar lstocchi 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.