Skip to content

Commit

Permalink
Cekk refactoring (#1)
Browse files Browse the repository at this point in the history
* add restapi endpoint and fix ci

* fix endpoint name

* enable sorting

* code cleanup

* fix: endpoint serch_tassonomie param value

* add bandit file

* remove dependency

* remove branch

* typo

* remove unused folder and fix tests

* fail under 30

---------

Co-authored-by: Giulia Ghisini <[email protected]>
Co-authored-by: Mauro Amico <[email protected]>
  • Loading branch information
3 people authored Jul 23, 2024
1 parent a63c438 commit a9b4383
Show file tree
Hide file tree
Showing 26 changed files with 620 additions and 348 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Security check - Bandit

on: push

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Security check - Bandit
uses: ioggstream/[email protected]
with:
project_path: src
# ignore_failure: true

# This is optional
#- name: Security check report artifacts
# uses: actions/upload-artifact@v4
# with:
# name: Security report
# path: output/security_report.txt

60 changes: 60 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Tests

on:
push:
paths-ignore:
- '**.md'
- '**.rst'
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python: ["3.10", "3.11"]
plone: ["60"]
steps:
- uses: actions/checkout@v3
- name: Cache eggs
uses: actions/cache@v3
with:
path: eggs
key: ${{ runner.OS }}-build-python${{ matrix.python }}-${{ matrix.plone }}
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
pip install -r requirements.txt -c constraints_plone${{ matrix.plone }}.txt
cp test_plone${{ matrix.plone }}.cfg buildout.cfg
- name: Install buildout
run: |
buildout -N code-analysis:return-status-codes=True
- name: Code analysis
run: |
bin/code-analysis
- name: Run tests
run: |
bin/test-coverage
env:
PROXY_BEARER_AUTH: on
#- name: Upload coverage data to coveralls.io
# run: |
# pip install coveralls
# coveralls --service=github
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# COVERALLS_FLAG_NAME: py${{ matrix.python }}-plone${{ matrix.plone }}-tz${{ matrix.tz }}
# COVERALLS_PARALLEL: true

#coveralls_finish:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Finished
# run: |
# pip install --upgrade coveralls
# coveralls --service=github --finish
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.coverage
.coverage.*
.python-version
*.egg-info
*.log
*.mo
Expand All @@ -12,6 +13,7 @@ bin/
buildout-cache/
develop-eggs/
eggs/
extras/
htmlcov/
include/
lib/
Expand Down
61 changes: 0 additions & 61 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion README.md

This file was deleted.

115 changes: 68 additions & 47 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,43 +27,75 @@
:alt: License


===============
iosanita.policy
===============
=======================
IO-Sanita policy
=======================

An add-on for Plone
Policy per il backend dei portali Io-Sanita.

Features
--------
Questo pacchetto si occupa di installare tutte le dipendenze necessarie per il progetto.

- Can be bullet points

Rotte API
=========

Examples
--------
@search-tassonomie
------------------

This add-on can be seen in action at the following sites:
- Is there a page on the internet where everybody can see the features?
Endpoint che serve a ricercare i contenuti marcati da una determinata tassonomia.

Parametri:

Documentation
-------------
- **type** (obbligatorio): il nome dell'indice in catalogo della tassonomia
- **value**: un eventuale valore per filtrare l'indice
- **portal_type**: un filtro su uno specifico portal_type
- **sort_on**: permette di ordinare i risultati in base ad un determinato indice
- **sort_order**: permette di scegliere l'ordinamento da usare

Full documentation for end users can be found in the "docs" folder, and is also available online at http://docs.plone.org/foo/bar
Le tassonomie (*type*) utilizzabili sono limitate:

- parliamo_di
- a_chi_si_rivolge_tassonomia

Translations
------------
Esempio di chiamata::

This product has been translated into
> http://localhost:8080/Plone/++api++/@search-tassonomie?type=a_chi_si_rivolge_tassonomia

- Klingon (thanks, K'Plai)

Risposta::

Installation
------------
{
"@id": "http://localhost:8080/Plone/++api++/@search-tassonomie?type=a_chi_si_rivolge_tassonomia",
"facets": {
"portal_types": [
{
"title": "Struttura",
"token": "Struttura"
}
]
},
"items": [
{
"@id": "http://localhost:8080/Plone/struttura",
"@type": "Struttura",
"description": "",
"enhanced_links_enabled": null,
"getObjSize": "0 KB",
"image_field": "",
"image_scales": null,
"mime_type": "text/plain",
"review_state": "private",
"title": "struttura",
"type_title": "Struttura"
}
],
"items_total": 1
}

Install iosanita.policy by adding it to your buildout::
Installazione
=============

Per installare iosanita.policy bisogna per prima cosa aggiungerlo al buildout::

[buildout]

Expand All @@ -73,39 +105,28 @@ Install iosanita.policy by adding it to your buildout::
iosanita.policy


and then running ``bin/buildout``


Authors
-------

Provided by awesome people ;)


Contributors
------------

Put your name here, you deserve it!
e poi lanciare il buildout con ``bin/buildout``.

- ?
Successivamente va installato dal pannello di controllo di Plone.


Contribute
----------
Contribuisci
============

- Issue Tracker: https://github.com/collective/iosanita.policy/issues
- Source Code: https://github.com/collective/iosanita.policy
- Documentation: https://docs.plone.org/foo/bar
- Issue Tracker: https://github.com/redturtle/iosanita.policy/issues
- Codice sorgente: https://github.com/redturtle/iosanita.policy


Support
-------
Licenza
=======

If you are having issues, please let us know.
We have a mailing list located at: [email protected]
Questo progetto è rilasciato con licenza GPLv2.

Autori
======

License
-------
Questo progetto è stato sviluppato da **RedTurtle Technology**.

The project is licensed under the GPLv2.
.. image:: https://avatars1.githubusercontent.com/u/1087171?s=100&v=4
:alt: RedTurtle Technology Site
:target: http://www.redturtle.it/
20 changes: 13 additions & 7 deletions base.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parts =
instance
test
# we use tox for testing and linting, by default
# code-analysis
code-analysis
coverage
test-coverage
createcoverage
Expand All @@ -19,7 +19,9 @@ parts =
vscode

develop = .

sources-dir = extras
auto-checkout = *
always-checkout = force

[instance]
recipe = plone.recipe.zope2instance
Expand All @@ -37,10 +39,10 @@ recipe = collective.recipe.vscode
eggs = ${instance:eggs}
autocomplete-use-omelette = True

# [code-analysis]
# recipe = plone.recipe.codeanalysis
# directory = ${buildout:directory}/src/iosanita
# return-status-codes = False
[code-analysis]
recipe = plone.recipe.codeanalysis
directory = ${buildout:directory}/src/iosanita
return-status-codes = False


[omelette]
Expand Down Expand Up @@ -68,7 +70,7 @@ input = inline:
export TZ=UTC
${buildout:directory}/bin/coverage run bin/test $*
${buildout:directory}/bin/coverage html
${buildout:directory}/bin/coverage report -m --fail-under=90
${buildout:directory}/bin/coverage report -m --fail-under=30
# Fail (exit status 1) if coverage returns exit status 2 (this happens
# when test coverage is below 100%.
output = ${buildout:directory}/bin/test-coverage
Expand Down Expand Up @@ -109,3 +111,7 @@ scripts =
[versions]
# Don't use a released version of iosanita.policy
iosanita.policy =
setuptools =

[sources]
iosanita.contenttypes = git https://github.com/RedTurtle/iosanita.contenttypes.git
12 changes: 8 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ ignore =
.gitattributes

[isort]
# black compatible isort rules:
profile = plone
# for details see
# http://docs.plone.org/develop/styleguide/python.html#grouping-and-sorting
force_alphabetical_sort = True
force_single_line = True
lines_after_imports = 2
line_length = 200
not_skip = __init__.py

[flake8]
# black compatible flake8 rules:
Expand All @@ -17,11 +22,10 @@ ignore =
E501
T001
C813
C101
# E203, E266
exclude = bootstrap.py,docs,*.egg.,omelette
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9

builtins = unicode,basestring

Loading

0 comments on commit a9b4383

Please sign in to comment.