Moose Platform

repository·development·Indexed 41 days ago

https://github.com/moosetechnology/moose

An open-source platform for software and data analysis providing services for importing, parsing, modeling, measuring, querying, and mining data. It integrates with Pharo and supports various Famix generators for analyzing languages such as Java, C#, .NET, SAP, Fortran, and C/C++. The platform includes tools for static analysis, such as identifying tested methods and extracting REST services from Java Spring applications.

Tokens
2K
Snippets
2
Records
11
Agent score
100%

What's inside Moose

  1. Find methods with a specific pragma or annotation

    development

    To find all methods within specific packages that carry a particular pragma or annotation, follow this workflow:

    1. Identify the correct AnnotationType in your model (e.g., use FamixStAnnotationType for Pharo code).
    2. Filter the AnnotationType to match your target (e.g., by name, such as "example").
    3. Retrieve all AnnotationInstance objects for that type.
    4. Access the annotatedEntity property of those instances to get the actual methods or entities being annotated.

    Example: Searching for the example pragma in a Rubric package model returns specific methods like RubFloatingEditorBuilder>>exampleCommandLauncher.

  2. Release stable versions of Moosetechnology projects

    development

    If a stable Moose version requires specific commits from related repositories (like Famix, FamixTagging, or MooseIDE), follow these steps in those repositories:

    1. Create a semantic version release (e.g., vX.Y.Z) via the GitHub interface.
    2. Manage generic tags: Move or create tags vX.x.x and vX.Y.x to point to the release commit. This must be done via the command line or a Git tool (not the GitHub UI):
      • Fast-forward the tag to the release commit.
      • Push the tag.

    Ensure you have three tags pointing to the release commit: the specific version, the major/minor tag, and the patch tag.

  3. Identify tested methods via static analysis

    development

    You can determine if a specific method is likely tested by analyzing its incoming invocations.

    Steps to perform this analysis:

    1. Select a target method (ensure it is a production method, not a test method).
    2. Trace all incoming invocations to see if any of them originate from test methods.
    3. Use a "Navigation query" or a visualization tool like a "Navigation tree" to inspect these relationships.

    Example Scenario: In a model containing Collections-Atomic and Collections-Atomic-Tests, you can check if LIFOQueue>>nextOrNil or WaitfreeQueue>>nextOrNil are tested by verifying if they are directly invoked by test methods.

  4. Retrieve REST services from a Java Spring application

    development

    You can extract the available REST services, including their methods and parameters, from a Java Spring project by analyzing annotations:

    1. Search the Java Project for the @Path annotation.
    2. Retrieve the classes annotated with @Path and identify their path parameters.
    3. Collect all methods belonging to those classes.
    4. Filter these methods to find those marked with REST-specific annotations (e.g., @GET, @POST).
    5. Determine the final endpoint path for each method by checking for @Path annotations applied directly to the methods.

    Note: This requires a Java model, which can be generated using VerveineJ.

  5. Load Moose in a Pharo image via Metacello

    development

    You can load Moose into an existing Pharo image using Metacello. The command you use depends on the version of Pharo you are running and the version of Moose you wish to install.

    #### Latest version: Moose 13 (Pharo 13 or 14)
    Metacello new
        baseline: 'Moose';
        repository: 'github://moosetechnology/Moose:development/src';
        onWarningLog;
        load
    
    #### Stable version: Moose 12 (Pharo 12 or 13)
    [ Metacello new
        baseline: 'Moose';
        repository: 'github://moosetechnology/Moose:v12.x.x/src';
        load ]
        on: MCMergeOrLoadWarning
        do: [ :warning | warning load ]
    
    #### Old stable version: Moose 11 (Pharo 11 or 12)
    [ Metacello new
        baseline: 'Moose';
        repository: 'github://moosetechnology/Moose:v11.x.x/src';
        load ]
        on: MCMergeOrLoadWarning
        do: [ :warning | warning load ]
  6. Update Pharo Launcher sources for Moose images

    development

    To make new Moose images available in Pharo Launcher, you must define them in a sources.list format.

    1. Test locally with mysources.list

    Create a local mysources.list file to verify your configuration. Example structure:

    [
    	PhLTemplateSource {
    		#type : #URLGroup,
    		#name : 'Moose 9 - stable',
    		#templates : [
    			PhLTemplateSource {
    				#type : #URL,
    				#name : 'Moose9',
    				#url : 'https://github.com/moosetechnology/Moose/releases/download/v9.x.x/Moose9-stable-Pharo64-10.zip'
    			}
    		]
    	}
    ]

    2. Integrate with Pharo Launcher

    1. Fork the pharo-launcher repository.
    2. Modify sources.list to include your new Moose sources and remove obsolete versions.
    3. Open a Pull Request to the pharo-launcher repository.
    4. Mandatory: Request in your PR that changes be uploaded to https://files.pharo.org. If the update is not processed, contact the Pharo Launcher maintainers (Christophe Demarrey, Markus Denker, Guille Polito, or Stéphane Ducasse).
    [
    	PhLTemplateSource {
    		#type : #URLGroup,
    		#name : 'Moose 9 - stable',
    		#templates : [
    			PhLTemplateSource {
    				#type : #URL,
    				#name : 'Moose9',
    				#url : 'https://github.com/moosetechnology/Moose/releases/download/v9.x.x/Moose9-stable-Pharo64-10.zip'
    			}
    		]
    	}
    ]
  7. Find all instantiations of a class and its subclasses

    development

    To map out where a class (and its inheritance hierarchy) is being instantiated, use the following logic:

    1. Select the base class.
    2. Identify all its subclasses.
    3. Collect all methods from both the base class and the subclasses.
    4. Filter for constructor methods (e.g., new MyClass() in Java).
    5. Follow the incoming invocations of those constructor methods to find all instantiation sites.

    Use Case: This is useful for determining all widget creation points in a GUI application. For Java models, use the VerveineJ parser.

  8. Configure Moose versioning and CI for a new stable branch

    development

    When creating a new stable branch (e.g., v10) from development, perform the following updates:

    Update Version Metadata

    Update MooseVersion>>#initialize in the Smalltalk source to reflect the new major version number. This ensures MooseHelp and the Moose welcome window display the correct version.

    Update CI Workflows

    Update Moose/.github/workflows/versions.json with:

    • The Moose version name.
    • Compatible Pharo version(s).
    • The release name for stable evolution (e.g., vN.x.x).

    To build a new image after every push to the stable branch, update Moose/.github/workflows/continuous.yml in the development branch:

    on: push:
      branches:
        - development
        - v9
        - # new stable branch vN

    Configure Branch Protection

    In GitHub Settings > Branches, add a rule for the new branch:

    • Require a pull request before merging: Uncheck 'Require approvals'.
    • Require status checks to pass before merging: Select the Pharo versions that must pass.
    • Include administrators.