Skip to content

Commit

Permalink
updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
saharmehrpour committed Jul 5, 2024
1 parent 60435b5 commit 1599781
Showing 1 changed file with 6 additions and 125 deletions.
131 changes: 6 additions & 125 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,130 +1,11 @@
# Active Documentation
# ActiveDocumentation

This app is written in "React" framework.
- It communicates with the [IDE Connector](https://github.com/devuxd/ActiveDocumentation/tree/RulePad-version) using "Web-Socket".
- It is based on _srcML_ library, which should be installed as instructed [here](https://github.com/devuxd/active-doc-client/wiki#installing-srcml).
ActiveDocumentation is an IDE plugin for working with design decisions.

## spmf.jar
# Users Manual

This file is required for FP_MAX selectedAlgorithm (for mining design rules) to execute. It can be downloaded from this repository or [here](http://www.philippe-fournier-viger.com/spmf/index.php?link=download.php).
**The file should be copied/moved to the root directory of the project.**
To set up ActiveDocumentation, refer to this [wiki page](https://github.com/ourcodeinc/ActiveDocumentation-webapp/wiki/User-Manual).

# Developers Guide

## ruleTable.json

There must be a file name `ruleTable.json` in the project folder in which all rules are stored. `grammar` field is recently added for each rule.
It is mandatory but is generated for newly added rules. Here is an example for this file:

```javascript
[
{
"index": "1",
"title": "All Buttons must have a title",
"description": "IF a JButton is created\nTHEN it should be initialized and have a title upon creating.",
"tags": [
"Labeling"
],
"checkForFilesFolders": [
"src"
],
"checkForFilesFoldersConstraints": "INCLUDE",
"processFilesFolders": "WITHIN",
// JButtons
"quantifierXPathQuery": ["src:unit/src:class/src:block//src:decl_stmt/src:decl[src:type/src:name/text()=\"JButton\"]"],
// JButtons with labels in constructor
"constraintXPathQuery": ["src:unit/src:class/src:block//src:decl_stmt/src:decl[src:type/src:name/text()=\"JButton\" and count(src:init/src:expr/src:call/src:argument_list/src:argument)>0]"]
},
{
"index": "6",
"title": "Communication between artifacts should be indirected through a Command",
"description": "IF an Artifact needs to communicate with another artifact\nTHEN it should create a Command describing the desired action to be performed.\nEach Artifact exists in a separate shard, which may execute in parallel on a separate server. An artifact may communicate with another artifact by creating a Command which describes the action that it wishes the receiving Artifact to perform.",
"tags": [
"Sharding",
"Command",
"Entity",
"Persistence"
],
"checkForFilesFolders": [
"src/com/crowdcoding/commands", "src/com/crowdcoding/entities"
],
"checkForFilesFoldersConstraints": "INCLUDE",
"processFilesFolders": "MIXED",
"quantifierQueryType": "FIND_FROM_TEXT",
// Calling constructors of all entity objects
"quantifierXPathQuery": ["//src:unit/src:class[(src:annotation/src:name[text()=\"Entity\"] or src:annotation/src:name[text()=\"Subclass\"])]/src:name/text()",
"//src:unit/src:class[src:super/src:extends/src:name/text()=\"Command\"]/src:block/src:class/src:block/descendant-or-self::src:decl_stmt/src:decl[src:init/src:expr/src:call/src:name/text()=\"<TEMP>\"]"],
"constraintQueryType": "RETURN_TO_BASE",
// Calling constructors of allowed entity objects",
"constraintXPathQuery": ["//src:unit/src:class/src:block/src:function_decl[src:name/text()=\"execute\"]/src:parameter_list/src:parameter/src:decl/src:type/src:name[not(text()=\"String\")]/text()",
"//src:unit/src:class[src:name/text()=\"<TEMP>\" or (src:super/src:extends/src:name/text()=\"<TEMP>\")]/src:name/text()",
"//src:unit/src:class[src:super/src:extends/src:name/text()=\"Command\"]/src:block/src:class/src:block/descendant-or-self::src:decl_stmt/src:decl[src:init/src:expr/src:call/src:name/text()=\"<TEMP>\"]"]
},
{
"index": "11",
"title": "@Entity classes must be registered in the CrowdServlet class",
"description": "IF a class is an Entity class or subclass \nTHEN it must be registered in 'CrowdServlet' class by ObjectifyService.\nAll entities needs to be registered with Objectify, so that Objectify knows to persist them. The registration must be done in 'CrowdServlet.java'",
"tags": [
"Entity", "Objectify", "Persistence"
],
"checkForFilesFolders": [
"src/com/crowdcoding/entities", "src/com/crowdcoding/servlets"
],
"checkForFilesFoldersConstraints": "INCLUDE",
"processFilesFolders": "MIXED",
// Entity classes
"quantifierXPathQuery": ["//src:unit/src:class[(src:annotation/src:name[text()=\"Entity\"] or src:annotation/src:name[text()=\"Subclass\"])]"],
"constraintQueryType": "FIND_FROM_TEXT",
// Registered classes
"constraintXPathQuery": ["//src:unit/src:class[src:name/text()=\"CrowdServlet\"]//src:expr_stmt/src:expr/src:call[src:name/src:name/text()=\"ObjectifyService\" and src:name/src:name/text()=\"register\"]/src:argument_list/src:argument/src:expr/src:name/src:name[1]/text()",
"//src:unit/src:class[src:name/text()=\"<TEMP>\"]"]
}
]
```


## tagTable.json

There is also another json file named `tagTable.json`. In this file we store information about tags. Here is an example for this file:

```javascript
[
{
"ID": "0",
"tagName": "Labeling",
"detail": "Rules about labeling the items used in the application. The labeling must follows special policies."
},
{
"ID": "1",
"tagName": "Objects",
"detail": "Rules about object created in the application. For each object there might be some constraints and considerations."
}
]
```

## RulePad Grammar

This system is using ANTLR4.

* The grammar is stored in `rulePadGrammar.g4`
* The generated code with ANTLR is created through `gradle` script.
* The `gradle.build` file is located in the root directory of the project.
* Run `gradle generateParser`

## Clearing Search history in IntelliJ (for Learning Design Rules)

Edit the related workspace xml file in this directory (in MacOS):
`~/Library/Application Support/JetBrains/IntelliJIdea2020.1/workspace`

## Used Ports

Three ports are used for this application:
* 8887 for websocket
* 3000 for application server (Changing Frequently, check package.json for the active port)


## Dev Reports
Currently, there are issues in upgrading the dependencies.
If devDependencies are updated, then antlr-4 become incompatible unless a configuration of Webpack is changed.
If only "react-scripts" is updated to "^4.0.3", then there would be warning about eslint that can be removed
by adding SKIP_PREFLIGHT_CHECK=true to the .env file.
To install, `npm install --legacy-peer-deps` should be used.
Refer to this [wiki page](https://github.com/ourcodeinc/ActiveDocumentation-webapp/wiki/ActiveDocumentation-Documentation) to understand ActiveDocumentation codebase.

0 comments on commit 1599781

Please sign in to comment.