forked from zaclys/searxng
		
	Merge pull request #105 from return42/yaml
[enh] add test.yamllint - lint yaml files
This commit is contained in:
		
						commit
						5f76238d5c
					
				
					 13 changed files with 1259 additions and 1171 deletions
				
			
		|  | @ -50,37 +50,41 @@ | |||
| ((nil | ||||
|   . ((fill-column . 80) | ||||
|      (indent-tabs-mode . nil) | ||||
|      )) | ||||
|  (makefile-gmake-mode | ||||
|   . ((indent-tabs-mode . t) | ||||
|      )) | ||||
|  (python-mode | ||||
|   . ((indent-tabs-mode . nil) | ||||
| 
 | ||||
|      ;; project root folder is where the `.dir-locals.el' is located | ||||
|      (eval . (setq-local | ||||
| 	      prj-root (locate-dominating-file  default-directory ".dir-locals.el"))) | ||||
| 
 | ||||
|      (eval . (setq-local | ||||
| 	      python-environment-directory (expand-file-name "./local" prj-root))) | ||||
| 
 | ||||
|      ;; use 'py3' enviroment as default | ||||
|      (eval . (setq-local | ||||
| 	      python-environment-default-root-name "py3")) | ||||
| 
 | ||||
|      (eval . (setq-local | ||||
| 	      python-shell-virtualenv-root | ||||
| 	      (concat python-environment-directory | ||||
| 		      "/" | ||||
| 		      python-environment-default-root-name))) | ||||
| 
 | ||||
|      ;; python-shell-virtualenv-path is obsolete, use python-shell-virtualenv-root! | ||||
|      ;; (eval . (setq-local | ||||
|      ;; 	 python-shell-virtualenv-path python-shell-virtualenv-root)) | ||||
| 
 | ||||
|               (expand-file-name python-environment-default-root-name python-environment-directory) | ||||
|               )) | ||||
|      (eval . (setq-local | ||||
| 	      python-shell-interpreter | ||||
| 	      (expand-file-name "bin/python" python-shell-virtualenv-root))) | ||||
|      )) | ||||
| 
 | ||||
|  (makefile-gmake-mode | ||||
|   . ((indent-tabs-mode . t) | ||||
|      )) | ||||
| 
 | ||||
|  (yaml-mode | ||||
|   . ( | ||||
|      ;; flycheck should use the local py3 environment | ||||
|      (eval . (setq-local | ||||
| 	      flycheck-yaml-yamllint-executable | ||||
| 	      (expand-file-name "bin/yamllint" python-shell-virtualenv-root))) | ||||
|      (eval . (setq-local | ||||
|               flycheck-yamllintrc | ||||
|               (expand-file-name  ".yamllint.yml" prj-root))) | ||||
|      (flycheck-checker . yaml-yamllint) | ||||
|      )) | ||||
| 
 | ||||
|  (python-mode | ||||
|   . ((indent-tabs-mode . nil) | ||||
| 
 | ||||
|      (eval . (setq-local | ||||
| 	      python-environment-virtualenv | ||||
|  |  | |||
							
								
								
									
										16
									
								
								.yamllint.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								.yamllint.yml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| extends: default | ||||
| 
 | ||||
| rules: | ||||
| 
 | ||||
|   indentation: | ||||
|     spaces: 2 | ||||
| 
 | ||||
|   # 120 chars should be enough, but don't fail if a line is longer | ||||
|   line-length: | ||||
|     max: 120 | ||||
|     level: warning | ||||
|     allow-non-breakable-words: true | ||||
| 
 | ||||
|   # we don't have multiple document per file | ||||
|   document-start: disable | ||||
|   document-end: disable | ||||
							
								
								
									
										6
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -51,8 +51,8 @@ search.checker.%: install | |||
| 	$(Q)./manage pyenv.cmd searx-checker -v "$(subst _, ,$(patsubst search.checker.%,%,$@))" | ||||
| 
 | ||||
| PHONY += test ci.test test.shell | ||||
| ci.test: test.pep8 test.pylint test.unit test.robot | ||||
| test:    test.pep8 test.pylint test.unit test.robot test.shell | ||||
| ci.test: test.yamllint test.pep8 test.pylint test.unit test.robot | ||||
| test:    test.yamllint test.pep8 test.pylint test.unit test.robot test.shell | ||||
| test.shell: | ||||
| 	$(Q)shellcheck -x -s dash \
 | ||||
| 		dockerfiles/docker-entrypoint.sh | ||||
|  | @ -81,7 +81,7 @@ MANAGE += node.env node.clean | |||
| MANAGE += py.build py.clean | ||||
| MANAGE += pyenv pyenv.install pyenv.uninstall | ||||
| MANAGE += pypi.upload pypi.upload.test | ||||
| MANAGE += test.pylint test.pep8 test.unit test.coverage test.robot test.clean | ||||
| MANAGE += test.yamllint test.pylint test.pep8 test.unit test.coverage test.robot test.clean | ||||
| MANAGE += themes.all themes.oscar themes.simple themes.bootstrap | ||||
| 
 | ||||
| PHONY += $(MANAGE) | ||||
|  |  | |||
							
								
								
									
										10
									
								
								manage
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								manage
									
										
									
									
									
								
							|  | @ -29,6 +29,11 @@ pylint.FILES() { | |||
|     grep -l -r --include \*.py '^#[[:blank:]]*lint:[[:blank:]]*pylint' searx searx_extra tests | ||||
| } | ||||
| 
 | ||||
| YAMLLINT_FILES=() | ||||
| while IFS= read -r line; do | ||||
|    YAMLLINT_FILES+=("$line") | ||||
| done <<< "$(git ls-files './tests/*.yml' './searx/*.yml')" | ||||
| 
 | ||||
| PYLINT_SEARX_DISABLE_OPTION="\ | ||||
| I,C,R,\ | ||||
| W0105,W0212,W0511,W0603,W0613,W0621,W0702,W0703,W1401,\ | ||||
|  | @ -391,6 +396,11 @@ pypi.upload.test() { | |||
|     pyenv.cmd twine upload -r testpypi "${PYDIST}"/* | ||||
| } | ||||
| 
 | ||||
| test.yamllint() { | ||||
|     build_msg TEST "[pylint] \$PYLINT_FILES" | ||||
|     pyenv.cmd yamllint --format parsable "${YAMLLINT_FILES[@]}" | ||||
| } | ||||
| 
 | ||||
| test.pylint() { | ||||
|     # shellcheck disable=SC2086 | ||||
|     (   set -e | ||||
|  |  | |||
|  | @ -16,3 +16,4 @@ sphinxcontrib-programoutput==0.17 | |||
| sphinx-autobuild==2021.3.14 | ||||
| linuxdoc==20210324 | ||||
| aiounittest==1.4.0 | ||||
| yamllint==1.26.1 | ||||
|  |  | |||
							
								
								
									
										2015
									
								
								searx/settings.yml
									
										
									
									
									
								
							
							
						
						
									
										2015
									
								
								searx/settings.yml
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -1,53 +1,53 @@ | |||
| general: | ||||
|     debug : False | ||||
|     instance_name : "searx_test" | ||||
|   debug: false | ||||
|   instance_name: "searx_test" | ||||
| 
 | ||||
| search: | ||||
|     language: "all" | ||||
|   language: "all" | ||||
| 
 | ||||
| server: | ||||
|     port : 11111 | ||||
|     bind_address : 127.0.0.1 | ||||
|     secret_key : "changedultrasecretkey" | ||||
|     base_url : False | ||||
|     http_protocol_version : "1.0" | ||||
|   port: 11111 | ||||
|   bind_address: 127.0.0.1 | ||||
|   secret_key: "changedultrasecretkey" | ||||
|   base_url: false | ||||
|   http_protocol_version: "1.0" | ||||
| 
 | ||||
| ui: | ||||
|     static_path : "" | ||||
|     templates_path : "" | ||||
|     default_theme : oscar | ||||
|   static_path: "" | ||||
|   templates_path: "" | ||||
|   default_theme: oscar | ||||
| 
 | ||||
| preferences: | ||||
|     lock: [] | ||||
|   lock: [] | ||||
| 
 | ||||
| outgoing: | ||||
|     request_timeout : 1.0 # seconds | ||||
|     useragent_suffix : "" | ||||
|   request_timeout: 1.0  # seconds | ||||
|   useragent_suffix: "" | ||||
| 
 | ||||
| engines: | ||||
|   - name : general dummy | ||||
|     engine : dummy | ||||
|     categories : general | ||||
|     shortcut : gd | ||||
|   - name: general dummy | ||||
|     engine: dummy | ||||
|     categories: general | ||||
|     shortcut: gd | ||||
| 
 | ||||
|   - name : dummy dummy | ||||
|     engine : dummy | ||||
|     categories : dummy | ||||
|     shortcut : dd | ||||
|   - name: dummy dummy | ||||
|     engine: dummy | ||||
|     categories: dummy | ||||
|     shortcut: dd | ||||
| 
 | ||||
| locales: | ||||
|     en : English | ||||
|     hu : Magyar | ||||
|   en: English | ||||
|   hu: Magyar | ||||
| 
 | ||||
| doi_resolvers : | ||||
|   oadoi.org : 'https://oadoi.org/' | ||||
|   doi.org : 'https://doi.org/' | ||||
|   doai.io  : 'https://dissem.in/' | ||||
|   sci-hub.se : 'https://sci-hub.se/' | ||||
|   sci-hub.do : 'https://sci-hub.do/' | ||||
|   scihubtw.tw : 'https://scihubtw.tw/' | ||||
|   sci-hub.st : 'https://sci-hub.st/' | ||||
|   sci-hub.bar : 'https://sci-hub.bar/' | ||||
|   sci-hub.it.nf : 'https://sci-hub.it.nf/' | ||||
| doi_resolvers: | ||||
|   oadoi.org: 'https://oadoi.org/' | ||||
|   doi.org: 'https://doi.org/' | ||||
|   doai.io: 'https://dissem.in/' | ||||
|   sci-hub.se: 'https://sci-hub.se/' | ||||
|   sci-hub.do: 'https://sci-hub.do/' | ||||
|   scihubtw.tw: 'https://scihubtw.tw/' | ||||
|   sci-hub.st: 'https://sci-hub.st/' | ||||
|   sci-hub.bar: 'https://sci-hub.bar/' | ||||
|   sci-hub.it.nf: 'https://sci-hub.it.nf/' | ||||
| 
 | ||||
| default_doi_resolver : 'oadoi.org' | ||||
| default_doi_resolver: 'oadoi.org' | ||||
|  |  | |||
|  | @ -1,2 +1,2 @@ | |||
| Test: | ||||
|   ********** | ||||
|   "**********" | ||||
|  |  | |||
|  | @ -1,111 +1,111 @@ | |||
| general: | ||||
|     debug : False | ||||
|     instance_name : "searx" | ||||
|   debug: false | ||||
|   instance_name: "searx" | ||||
| 
 | ||||
| search: | ||||
|     safe_search : 0 | ||||
|     autocomplete : "" | ||||
|     default_lang : "" | ||||
|     ban_time_on_fail : 5 | ||||
|     max_ban_time_on_fail : 120 | ||||
|   safe_search: 0 | ||||
|   autocomplete: "" | ||||
|   default_lang: "" | ||||
|   ban_time_on_fail: 5 | ||||
|   max_ban_time_on_fail: 120 | ||||
| 
 | ||||
| server: | ||||
|     port : 9000 | ||||
|     bind_address : "0.0.0.0" | ||||
|     secret_key : "user_settings_secret" | ||||
|     base_url : False | ||||
|     image_proxy : False | ||||
|     http_protocol_version : "1.0" | ||||
|     method: "POST" | ||||
|     default_http_headers: | ||||
|         X-Content-Type-Options : nosniff | ||||
|         X-XSS-Protection : 1; mode=block | ||||
|         X-Download-Options : noopen | ||||
|         X-Robots-Tag : noindex, nofollow | ||||
|         Referrer-Policy : no-referrer | ||||
|   port: 9000 | ||||
|   bind_address: "0.0.0.0" | ||||
|   secret_key: "user_settings_secret" | ||||
|   base_url: false | ||||
|   image_proxy: false | ||||
|   http_protocol_version: "1.0" | ||||
|   method: "POST" | ||||
|   default_http_headers: | ||||
|     X-Content-Type-Options: nosniff | ||||
|     X-XSS-Protection: 1; mode=block | ||||
|     X-Download-Options: noopen | ||||
|     X-Robots-Tag: noindex, nofollow | ||||
|     Referrer-Policy: no-referrer | ||||
| 
 | ||||
| ui: | ||||
|     static_path : "" | ||||
|     templates_path : "" | ||||
|     default_theme : oscar | ||||
|     default_locale : "" | ||||
|     theme_args : | ||||
|         oscar_style : logicodev | ||||
|   static_path: "" | ||||
|   templates_path: "" | ||||
|   default_theme: oscar | ||||
|   default_locale: "" | ||||
|   theme_args: | ||||
|     oscar_style: logicodev | ||||
| 
 | ||||
| engines: | ||||
|   - name : wikidata | ||||
|     engine : wikidata | ||||
|     shortcut : wd | ||||
|     timeout : 3.0 | ||||
|     weight : 2 | ||||
|   - name: wikidata | ||||
|     engine: wikidata | ||||
|     shortcut: wd | ||||
|     timeout: 3.0 | ||||
|     weight: 2 | ||||
| 
 | ||||
|   - name : wikibooks | ||||
|     engine : mediawiki | ||||
|     shortcut : wb | ||||
|     categories : general | ||||
|     base_url : "https://{language}.wikibooks.org/" | ||||
|     number_of_results : 5 | ||||
|     search_type : text | ||||
|   - name: wikibooks | ||||
|     engine: mediawiki | ||||
|     shortcut: wb | ||||
|     categories: general | ||||
|     base_url: "https://{language}.wikibooks.org/" | ||||
|     number_of_results: 5 | ||||
|     search_type: text | ||||
| 
 | ||||
|   - name : wikinews | ||||
|     engine : mediawiki | ||||
|     shortcut : wn | ||||
|     categories : news | ||||
|     base_url : "https://{language}.wikinews.org/" | ||||
|     number_of_results : 5 | ||||
|     search_type : text | ||||
|   - name: wikinews | ||||
|     engine: mediawiki | ||||
|     shortcut: wn | ||||
|     categories: news | ||||
|     base_url: "https://{language}.wikinews.org/" | ||||
|     number_of_results: 5 | ||||
|     search_type: text | ||||
| 
 | ||||
|   - name : wikiquote | ||||
|     engine : mediawiki | ||||
|     shortcut : wq | ||||
|     categories : general | ||||
|     base_url : "https://{language}.wikiquote.org/" | ||||
|     number_of_results : 5 | ||||
|     search_type : text | ||||
|   - name: wikiquote | ||||
|     engine: mediawiki | ||||
|     shortcut: wq | ||||
|     categories: general | ||||
|     base_url: "https://{language}.wikiquote.org/" | ||||
|     number_of_results: 5 | ||||
|     search_type: text | ||||
| 
 | ||||
| locales: | ||||
|     en : English | ||||
|     ar : العَرَبِيَّة (Arabic) | ||||
|     bg : Български (Bulgarian) | ||||
|     bo : བོད་སྐད་ (Tibetian) | ||||
|     ca : Català (Catalan) | ||||
|     cs : Čeština (Czech) | ||||
|     cy : Cymraeg (Welsh) | ||||
|     da : Dansk (Danish) | ||||
|     de : Deutsch (German) | ||||
|     el_GR : Ελληνικά (Greek_Greece) | ||||
|     eo : Esperanto (Esperanto) | ||||
|     es : Español (Spanish) | ||||
|     et : Eesti (Estonian) | ||||
|     eu : Euskara (Basque) | ||||
|     fa_IR : (fārsī) فارسى (Persian) | ||||
|     fi : Suomi (Finnish) | ||||
|     fil : Wikang Filipino (Filipino) | ||||
|     fr : Français (French) | ||||
|     gl : Galego (Galician) | ||||
|     he : עברית (Hebrew) | ||||
|     hr : Hrvatski (Croatian) | ||||
|     hu : Magyar (Hungarian) | ||||
|     ia : Interlingua (Interlingua) | ||||
|     it : Italiano (Italian) | ||||
|     ja : 日本語 (Japanese) | ||||
|     lt : Lietuvių (Lithuanian) | ||||
|     nl : Nederlands (Dutch) | ||||
|     nl_BE : Vlaams (Dutch_Belgium) | ||||
|     oc : Lenga D'òc (Occitan) | ||||
|     pl : Polski (Polish) | ||||
|     pt : Português (Portuguese) | ||||
|     pt_BR : Português (Portuguese_Brazil) | ||||
|     ro : Română (Romanian) | ||||
|     ru : Русский (Russian) | ||||
|     sk : Slovenčina (Slovak) | ||||
|     sl : Slovenski (Slovene) | ||||
|     sr : српски (Serbian) | ||||
|     sv : Svenska (Swedish) | ||||
|     te : తెలుగు (telugu) | ||||
|     ta : தமிழ் (Tamil) | ||||
|     tr : Türkçe (Turkish) | ||||
|     uk : українська мова (Ukrainian) | ||||
|     vi : tiếng việt (Vietnamese) | ||||
|     zh : 中文 (Chinese) | ||||
|     zh_TW : 國語 (Taiwanese Mandarin) | ||||
|   en: English | ||||
|   ar: العَرَبِيَّة (Arabic) | ||||
|   bg: Български (Bulgarian) | ||||
|   bo: བོད་སྐད་ (Tibetian) | ||||
|   ca: Català (Catalan) | ||||
|   cs: Čeština (Czech) | ||||
|   cy: Cymraeg (Welsh) | ||||
|   da: Dansk (Danish) | ||||
|   de: Deutsch (German) | ||||
|   el_GR: Ελληνικά (Greek_Greece) | ||||
|   eo: Esperanto (Esperanto) | ||||
|   es: Español (Spanish) | ||||
|   et: Eesti (Estonian) | ||||
|   eu: Euskara (Basque) | ||||
|   fa_IR: (fārsī) فارسى (Persian) | ||||
|   fi: Suomi (Finnish) | ||||
|   fil: Wikang Filipino (Filipino) | ||||
|   fr: Français (French) | ||||
|   gl: Galego (Galician) | ||||
|   he: עברית (Hebrew) | ||||
|   hr: Hrvatski (Croatian) | ||||
|   hu: Magyar (Hungarian) | ||||
|   ia: Interlingua (Interlingua) | ||||
|   it: Italiano (Italian) | ||||
|   ja: 日本語 (Japanese) | ||||
|   lt: Lietuvių (Lithuanian) | ||||
|   nl: Nederlands (Dutch) | ||||
|   nl_BE: Vlaams (Dutch_Belgium) | ||||
|   oc: Lenga D'òc (Occitan) | ||||
|   pl: Polski (Polish) | ||||
|   pt: Português (Portuguese) | ||||
|   pt_BR: Português (Portuguese_Brazil) | ||||
|   ro: Română (Romanian) | ||||
|   ru: Русский (Russian) | ||||
|   sk: Slovenčina (Slovak) | ||||
|   sl: Slovenski (Slovene) | ||||
|   sr: српски (Serbian) | ||||
|   sv: Svenska (Swedish) | ||||
|   te: తెలుగు (telugu) | ||||
|   ta: தமிழ் (Tamil) | ||||
|   tr: Türkçe (Turkish) | ||||
|   uk: українська мова (Ukrainian) | ||||
|   vi: tiếng việt (Vietnamese) | ||||
|   zh: 中文 (Chinese) | ||||
|   zh_TW: 國語 (Taiwanese Mandarin) | ||||
|  |  | |||
|  | @ -1,14 +1,14 @@ | |||
| use_default_settings: | ||||
|     engines: | ||||
|         keep_only: | ||||
|             - wikibooks | ||||
|             - wikinews | ||||
|   engines: | ||||
|     keep_only: | ||||
|       - wikibooks | ||||
|       - wikinews | ||||
| server: | ||||
|     secret_key: "user_secret_key" | ||||
|     bind_address: "0.0.0.0" | ||||
|     default_http_headers: | ||||
|         Custom-Header: Custom-Value | ||||
|   secret_key: "user_secret_key" | ||||
|   bind_address: "0.0.0.0" | ||||
|   default_http_headers: | ||||
|     Custom-Header: Custom-Value | ||||
| engines: | ||||
|     - name: wikipedia | ||||
|     - name: newengine | ||||
|       engine: dummy | ||||
|   - name: wikipedia | ||||
|   - name: newengine | ||||
|     engine: dummy | ||||
|  |  | |||
|  | @ -1,10 +1,10 @@ | |||
| use_default_settings: | ||||
|     engines: | ||||
|         remove: | ||||
|             - wikibooks | ||||
|             - wikinews | ||||
|   engines: | ||||
|     remove: | ||||
|       - wikibooks | ||||
|       - wikinews | ||||
| server: | ||||
|     secret_key: "user_secret_key" | ||||
|     bind_address: "0.0.0.0" | ||||
|     default_http_headers: | ||||
|         Custom-Header: Custom-Value | ||||
|   secret_key: "user_secret_key" | ||||
|   bind_address: "0.0.0.0" | ||||
|   default_http_headers: | ||||
|     Custom-Header: Custom-Value | ||||
|  |  | |||
|  | @ -1,15 +1,15 @@ | |||
| use_default_settings: | ||||
|     engines: | ||||
|         remove: | ||||
|             - wikibooks | ||||
|             - wikinews | ||||
|   engines: | ||||
|     remove: | ||||
|       - wikibooks | ||||
|       - wikinews | ||||
| server: | ||||
|     secret_key: "user_secret_key" | ||||
|     bind_address: "0.0.0.0" | ||||
|     default_http_headers: | ||||
|         Custom-Header: Custom-Value | ||||
|   secret_key: "user_secret_key" | ||||
|   bind_address: "0.0.0.0" | ||||
|   default_http_headers: | ||||
|     Custom-Header: Custom-Value | ||||
| engines: | ||||
|     - name: wikipedia | ||||
|       tokens: ['secret_token'] | ||||
|     - name: newengine | ||||
|       engine: dummy | ||||
|   - name: wikipedia | ||||
|     tokens: ['secret_token'] | ||||
|   - name: newengine | ||||
|     engine: dummy | ||||
|  |  | |||
|  | @ -1,9 +1,9 @@ | |||
| use_default_settings: True | ||||
| use_default_settings: true | ||||
| server: | ||||
|     secret_key: "user_secret_key" | ||||
|     bind_address: "0.0.0.0" | ||||
|     default_http_headers: | ||||
|         Custom-Header: Custom-Value | ||||
|   secret_key: "user_secret_key" | ||||
|   bind_address: "0.0.0.0" | ||||
|   default_http_headers: | ||||
|     Custom-Header: Custom-Value | ||||
| result_proxy: | ||||
|    url : https://localhost/morty | ||||
|    key : "$ecretKey" | ||||
|   url: https://localhost/morty | ||||
|   key: "$ecretKey" | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Alexandre Flament
						Alexandre Flament