https://jira.onap.org/secure/RapidBoard.jspa?projectKey=CPS&rapidView=228
The cps-path-parser module uses Antlr. IntelliJ has an Antlr-v4 plugin If you want to use it it needs to be configured as follows:
/src/main/antlr4/org/onap/cps/cpspath/parser/antlr4/CpsPath.g4
file in the project file tree. <your git repo>\cps-path-parser\target\generated-sources\antlr4
org.onap.cps.cpspath.parser.antlr4
If using Intellij, it may still return an error where it cannot find the generated sources for Antlr4.
To resolve this:
Comment explaining what is the purpose of the code. Issue-ID: CPS-1 |
The following license template needs to be added and kept updated in CPS files (using the commenting scheme corresponding to each type of file):
/* * ============LICENSE_START======================================================= * Copyright (C) YYYY[-XXXX] <an organization> * Modifications Copyright (C) YYYY[-XXXX] <another organization> * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ |
Notes:
References:
*This table just list the most commonly required style conventions in CPS, it is not to be intended to be complete
Language / Domain | Type of object | Style | Example | Notes |
---|---|---|---|---|
Java / Groovy | Package | lowercase | org.onap.cps.rest.controller | |
Class | UpperCamelCase | AdminRestController | ||
Variable | lowerCamelCase | cpsAdminService | ||
Method | lowerCamelCase | createDataspace | ||
JSON (incl event payload) | Property | lowerCamelCase | cmHandles | |
Open API / REST see ONAP Swagger Style | Resource / Node | lowercase(?) plural | dataspaces | |
Model / Component | UpperCamelCase |
| ||
Property | Conform to model | See below caveat* | ||
SQL | Table | UPPER_SNAKE_CASE (singular) | FRAGMENT | |
Field | UPPER_SNAKE_CASE | DATASPACE_ID | ||
Liquibase | Table | lower_snake_case | fragment | |
Field | lower_snake_case | dataspace_id | ||
CloudNative Events | header field | lowercase | datacontenttype correlationid | See decision #17 on CPS Events Structure |
data fields | lowerCamelCase | cmHandId |
*A caveat to these styling conventions is that we should try to conform to the model which we are developing for. So if we model in yang we should manipulate that data using the kebab-casing convention as that is the convention used in yang models. However there are some endpoints where a convention has been set to use camelCasing when manipulating yang data. In these cases the current convention should be upheld to avoid backward incompatible changes.
We recommend that most user stories are accompanied with small wiki page to document/clarify some analysis for that user story.
CPS is promoting and using Groovy and Spock for all our unit test. All new modified code should include good quality test.
If you are new to Groovy and Spock look at OneSummit Groovy & Spock Workshop Nov 2022 it includes a demo project with exercises and solutions
see Groovy & Spock you can also contact the PTL Toine Siebelink for more details
See
As part of our best practice to finish a user story it should be demonstrated to team and if possible recorded
ONAP uses Jenkins based CICD tool chain. However, contributors are only given read access to the Jenkins servers. All jobs are created by automatic generation from JJB definitions.
https://jenkins.onap.org./view/cps/
See Bug Reporting Guidelines for CPS for details on reporting issues. Issues may be created here:
If you find any vulnerability please email the security contact with the information that you have.
The security contact is ; toine.siebelink@est.tech
We will give credit to anyone who reports a vulnerability so that we can fix it. If you wish to remain anonymous instead, please let us know and we will respect that.