Skip to content

# Base

The tool to check the availability or syntax of domain, IP or URL.

::

    ██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
    ██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
    ██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
    ██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
    ██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
    ╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides the base of all our CI classes.

Author: Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom

Special thanks: https://pyfunceble.github.io/#/special-thanks

Contributors: https://pyfunceble.github.io/#/contributors

Project link: https://github.com/funilrys/PyFunceble

Project documentation: https://docs.pyfunceble.com

Project homepage: https://pyfunceble.github.io/

License: ::

    Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025 Nissar Chababy

    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

        https://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.

## `ContinuousIntegrationBase`

Provides the base of all continuous integration methods.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`authorized` | `Optional[bool]` | The authorization to run. | `None`
`git_email` | `Optional[str]` | The email to apply while initializing the git repository for push. | `None`
`git_name` | `Optional[str]` | The name to apply while initializing the git repository for push. | `None`
`git_branch` | `Optional[str]` | The branch to use while testing. | `None`
`git_distribution_branch` | `Optional[str]` | The branch to push the results into. | `None`
`token` | `Optional[str]` | The token to apply while initializing the git repository for push. | `None`
`command` | `Optional[str]` | The command to execute before each push (except the latest one). | `None`
`end_command` | `Optional[str]` | The command to execute at the very end. | `None`
`commit_message` | `Optional[str]` | The commit message to apply before each push (except the latest one). | `None`
`end_commit_message` | `Optional[str]` | The commit message to apply at the very end. | `None`
`max_exec_minutes` | `Optional[int]` | The maximum of minutes to apply before considering the current session as finished. | `None`

Source code in `PyFunceble/cli/continuous_integration/base.py`

      68
      69
      70
      71
      72
      73
      74
      75
      76
      77
      78
      79
      80
      81
      82
      83
      84
      85
      86
      87
      88
      89
      90
      91
      92
      93
      94
      95
      96
      97
      98
      99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
     150
     151
     152
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
     214
     215
     216
     217
     218
     219
     220
     221
     222
     223
     224
     225
     226
     227
     228
     229
     230
     231
     232
     233
     234
     235
     236
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262
     263
     264
     265
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
     295
     296
     297
     298
     299
     300
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
     327
     328
     329
     330
     331
     332
     333
     334
     335
     336
     337
     338
     339
     340
     341
     342
     343
     344
     345
     346
     347
     348
     349
     350
     351
     352
     353
     354
     355
     356
     357
     358
     359
     360
     361
     362
     363
     364
     365
     366
     367
     368
     369
     370
     371
     372
     373
     374
     375
     376
     377
     378
     379
     380
     381
     382
     383
     384
     385
     386
     387
     388
     389
     390
     391
     392
     393
     394
     395
     396
     397
     398
     399
     400
     401
     402
     403
     404
     405
     406
     407
     408
     409
     410
     411
     412
     413
     414
     415
     416
     417
     418
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
     473
     474
     475
     476
     477
     478
     479
     480
     481
     482
     483
     484
     485
     486
     487
     488
     489
     490
     491
     492
     493
     494
     495
     496
     497
     498
     499
     500
     501
     502
     503
     504
     505
     506
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
     528
     529
     530
     531
     532
     533
     534
     535
     536
     537
     538
     539
     540
     541
     542
     543
     544
     545
     546
     547
     548
     549
     550
     551
     552
     553
     554
     555
     556
     557
     558
     559
     560
     561
     562
     563
     564
     565
     566
     567
     568
     569
     570
     571
     572
     573
     574
     575
     576
     577
     578
     579
     580
     581
     582
     583
     584
     585
     586
     587
     588
     589
     590
     591
     592
     593
     594
     595
     596
     597
     598
     599
     600
     601
     602
     603
     604
     605
     606
     607
     608
     609
     610
     611
     612
     613
     614
     615
     616
     617
     618
     619
     620
     621
     622
     623
     624
     625
     626
     627
     628
     629
     630
     631
     632
     633
     634
     635
     636
     637
     638
     639
     640
     641
     642
     643
     644
     645
     646
     647
     648
     649
     650
     651
     652
     653
     654
     655
     656
     657
     658
     659
     660
     661
     662
     663
     664
     665
     666
     667
     668
     669
     670
     671
     672
     673
     674
     675
     676
     677
     678
     679
     680
     681
     682
     683
     684
     685
     686
     687
     688
     689
     690
     691
     692
     693
     694
     695
     696
     697
     698
     699
     700
     701
     702
     703
     704
     705
     706
     707
     708
     709
     710
     711
     712
     713
     714
     715
     716
     717
     718
     719
     720
     721
     722
     723
     724
     725
     726
     727
     728
     729
     730
     731
     732
     733
     734
     735
     736
     737
     738
     739
     740
     741
     742
     743
     744
     745
     746
     747
     748
     749
     750
     751
     752
     753
     754
     755
     756
     757
     758
     759
     760
     761
     762
     763
     764
     765
     766
     767
     768
     769
     770
     771
     772
     773
     774
     775
     776
     777
     778
     779
     780
     781
     782
     783
     784
     785
     786
     787
     788
     789
     790
     791
     792
     793
     794
     795
     796
     797
     798
     799
     800
     801
     802
     803
     804
     805
     806
     807
     808
     809
     810
     811
     812
     813
     814
     815
     816
     817
     818
     819
     820
     821
     822
     823
     824
     825
     826
     827
     828
     829
     830
     831
     832
     833
     834
     835
     836
     837
     838
     839
     840
     841
     842
     843
     844
     845
     846
     847
     848
     849
     850
     851
     852
     853
     854
     855
     856
     857
     858
     859
     860
     861
     862
     863
     864
     865
     866
     867
     868
     869
     870
     871
     872
     873
     874
     875
     876
     877
     878
     879
     880
     881
     882
     883
     884
     885
     886
     887
     888
     889
     890
     891
     892
     893
     894
     895
     896
     897
     898
     899
     900
     901
     902
     903
     904
     905
     906
     907
     908
     909
     910
     911
     912
     913
     914
     915
     916
     917
     918
     919
     920
     921
     922
     923
     924
     925
     926
     927
     928
     929
     930
     931
     932
     933
     934
     935
     936
     937
     938
     939
     940
     941
     942
     943
     944
     945
     946
     947
     948
     949
     950
     951
     952
     953
     954
     955
     956
     957
     958
     959
     960
     961
     962
     963
     964
     965
     966
     967
     968
     969
     970
     971
     972
     973
     974
     975
     976
     977
     978
     979
     980
     981
     982
     983
     984
     985
     986
     987
     988
     989
     990
     991
     992
     993
     994
     995
     996
     997
     998
     999
    1000
    1001
    1002
    1003
    1004
    1005
    1006
    1007
    1008
    1009
    1010
    1011
    1012
    1013
    1014
    1015
    1016
    1017
    1018
    1019
    1020
    1021
    1022
    1023
    1024
    1025
    1026
    1027
    1028
    1029
    1030
    1031
    1032
    1033
    1034
    1035
    1036
    1037
    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    1057
    1058
    1059
    1060
    1061
    1062
    1063
    1064
    1065
    1066
    1067
    1068
    1069
    1070
    1071
    1072
    1073
    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    1084
    1085
    1086
    1087
    1088
    1089
    1090
    1091
    1092
    1093
    1094
    1095
    1096
    1097
    1098
    1099
    1100
    1101
    1102
    1103
    1104
    1105
    1106
    1107
    1108
    1109
    1110
    1111
    1112
    1113
    1114
    1115
    1116
    1117
    1118
    1119
    1120
    1121
    1122
    1123
    1124
    1125
    1126
    1127
    1128
    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136
    1137
    1138
    1139
    1140
    1141
    1142
    1143
    1144
    1145
    1146
    1147
    1148
    1149
    1150
    1151
    1152
    1153
    1154
    1155
    1156
    1157
    1158
    1159
    1160
    1161
    1162
    1163
    1164
    1165
    1166
    1167
    1168
    1169
    1170
    1171
    1172
    1173
    1174
    1175
    1176
    1177
    1178
    1179
    1180
    1181
    1182
    1183
    1184
    1185
    1186
    1187
    1188
    1189
    1190
    1191
    1192
    1193
    1194
    1195
    1196
    1197
    1198
    1199
    1200
    1201
    1202
    1203
    1204
    1205
    1206
    1207
    1208
    1209
    1210
    1211
    1212
    1213
    1214
    1215
    1216
    1217
    1218
    1219
    1220
    1221
    1222
    1223
    1224
    1225
    1226
    1227
    1228
    1229
    1230
    1231
    1232
    1233
    1234
    1235
    1236
    1237
    1238
    1239
    1240
    1241
    1242
    1243
    1244
    1245
    1246
    1247
    1248
    1249
    1250
    1251
    1252
    1253
    1254
    1255
    1256
    1257
    1258
    1259
    1260
    1261
    1262
    1263
    1264
    1265
    1266
    1267
    1268
    1269
    1270
    1271
    1272
    1273
    1274
    1275
    1276
    1277
    1278
    1279
    1280
    1281
    1282
    1283
    1284
    1285
    1286
    1287
    1288
    1289
    1290
    1291
    1292
    1293
    1294
    1295
    1296
    1297
    1298
    1299
    1300
    1301
    1302
    1303
    1304
    1305
    1306
    1307
    1308
    1309

    class ContinuousIntegrationBase:
        """
        Provides the base of all continuous integration methods.

        :param authorized:
            The authorization to run.
        :param git_email:
            The email to apply while initializing the git repository for push.
        :param git_name:
            The name to apply while initializing the git repository for push.
        :param git_branch:
            The branch to use while testing.
        :param git_distribution_branch:
            The branch to push the results into.
        :param token:
            The token to apply while initializing the git repository for push.
        :param command:
            The command to execute before each push (except the latest one).
        :param end_command:
            The command to execute at the very end.
        :param commit_message:
            The commit message to apply before each push (except the latest one).
        :param end_commit_message:
            The commit message to apply at the very end.
        :param max_exec_minutes:
            The maximum of minutes to apply before considering the current
            session as finished.
        """

        STD_AUTHORIZED: bool = False
        STD_GIT_EMAIL: Optional[str] = None
        STD_GIT_NAME: Optional[str] = None
        STD_GIT_BRANCH: Optional[str] = "master"
        STD_GIT_DISTRIBUTION_BRANCH: Optional[str] = "master"
        STD_COMMAND: Optional[str] = None
        STD_END_COMMAND: Optional[str] = None
        STD_COMMIT_MESSAGE: str = "PyFunceble - AutoSave"
        STD_END_COMMIT_MESSAGE: str = "PyFunceble - Results"
        STD_MAX_EXEC_MINUTES: int = 15

        COMMON_CI_SKIP_MARKER: List[str] = ["[skip ci]", "[ci skip]", "[no ci]"]

        end_commit_marker: str = "[ci skip]"

        _authorized: bool = False
        _git_email: Optional[str] = None
        _git_name: Optional[str] = None
        _git_branch: Optional[str] = None
        _git_distribution_branch: Optional[str] = None
        _token: Optional[str] = None
        _command: Optional[str] = None
        _end_command: Optional[str] = None
        _commit_message: Optional[str] = None
        _end_commit_message: Optional[str] = None
        _max_exec_minutes: Optional[int] = None

        start_time: Optional[datetime.datetime] = None
        expected_end_time: Optional[datetime.datetime] = None

        git_initialized: bool = False

        def __init__(
            self,
            *,
            authorized: Optional[bool] = None,
            git_email: Optional[str] = None,
            git_name: Optional[str] = None,
            git_branch: Optional[str] = None,
            git_distribution_branch: Optional[str] = None,
            token: Optional[str] = None,
            command: Optional[str] = None,
            end_command: Optional[str] = None,
            commit_message: Optional[str] = None,
            end_commit_message: Optional[str] = None,
            max_exec_minutes: Optional[int] = None,
        ) -> None:
            if authorized is not None:
                self.authorized = authorized
            else:
                self.guess_and_set_authorized()

            if git_email is not None:
                self.git_email = git_email
            else:
                self.guess_and_set_git_email()

            if git_name is not None:
                self.git_name = git_name
            else:
                self.guess_and_set_git_name()

            if git_branch is not None:
                self.git_branch = git_branch
            else:
                self.guess_and_set_git_branch()

            if git_distribution_branch is not None:
                self.git_distribution_branch = git_distribution_branch
            else:
                self.guess_and_set_git_distribution_branch()

            if token is not None:
                self.token = token
            else:
                self.guess_and_set_token()

            if command is not None:
                self.command = command
            else:
                self.guess_and_set_command()

            if end_command is not None:
                self.end_command = end_command
            else:
                self.guess_and_set_end_command()

            if commit_message is not None:
                self.commit_message = commit_message
            else:
                self.guess_and_set_commit_message()

            if end_commit_message is not None:
                self.end_commit_message = end_commit_message
            else:
                self.guess_and_set_end_commit_message()

            if max_exec_minutes is not None:
                self.max_exec_minutes = max_exec_minutes
            else:
                self.guess_and_set_max_exec_minutes()

        def execute_if_authorized(default: Any = None):  # pylint: disable=no-self-argument
            """
            Executes the decorated method only if we are authorized to process.
            Otherwise, apply the given :code:`default`.
            """

            def inner_method(func):
                @functools.wraps(func)
                def wrapper(self, *args, **kwargs):
                    if self.authorized:
                        return func(self, *args, **kwargs)  # pylint: disable=not-callable
                    return self if default is None else default

                return wrapper

            return inner_method

        def ensure_git_email_is_given(func):  # pylint: disable=no-self-argument
            """
            Ensures that the Git Email is given before launching the decorated
            method.

            :raise PyFunceble.cli.continuous_integration.exceptions.GitEmailNotFound:
                When the Git Email is not found.
            """

            @functools.wraps(func)
            def wrapper(self, *args, **kwargs):
                if not self.git_email:
                    # pylint: disable=line-too-long
                    raise PyFunceble.cli.continuous_integration.exceptions.GitEmailNotFound()

                return func(self, *args, **kwargs)  # pylint: disable=not-callable

            return wrapper

        def ensure_git_name_is_given(func):  # pylint: disable=no-self-argument
            """
            Ensures that the Git Name is given before launching the decorated
            method.

            :raise PyFunceble.cli.continuous_integration.exceptions.GitNameNotFound:
                When the Git Name is not found.
            """

            @functools.wraps(func)
            def wrapper(self, *args, **kwargs):
                if not self.git_name:
                    raise PyFunceble.cli.continuous_integration.exceptions.GitNameNotFound()

                return func(self, *args, **kwargs)  # pylint: disable=not-callable

            return wrapper

        def ensure_git_branch_is_given(func):  # pylint: disable=no-self-argument
            """
            Ensures that the Git Branch is given before launching the decorated
            method.

            :raise PyFunceble.cli.continuous_integration.exceptions.GitBranchNotFound:
                When the Git Branch is not found.
            """

            @functools.wraps(func)
            def wrapper(self, *args, **kwargs):
                if not self.git_name:
                    raise PyFunceble.cli.continuous_integration.exceptions.GitNameNotFound()

                return func(self, *args, **kwargs)  # pylint: disable=not-callable

            return wrapper

        def ensure_git_distribution_branch_is_given(
            func,
        ):  # pylint: disable=no-self-argument,line-too-long
            """
            Ensures that the Git distribution Branch is given before launching the
            decorated method.

            :raise PyFunceble.cli.continuous_integration.exceptions.GitDistributionBranchNotFound:
                When the Git distribution Branch is not found.
            """

            @functools.wraps(func)
            def wrapper(self, *args, **kwargs):
                if not self.git_name:
                    raise PyFunceble.cli.continuous_integration.exceptions.GitNameNotFound()

                return func(self, *args, **kwargs)  # pylint: disable=not-callable

            return wrapper

        def ensure_token_is_given(func):  # pylint: disable=no-self-argument
            """
            Ensures that the token is given before launching the decorated method.

            :raise PyFunceble.cli.continuous_integration.exceptions.TokenNotFound:
                When the token is not found.
            """

            @functools.wraps(func)
            def wrapper(self, *args, **kwargs):
                if not self.token:
                    raise PyFunceble.cli.continuous_integration.exceptions.TokenNotFound()

                return func(self, *args, **kwargs)  # pylint: disable=not-callable

            return wrapper

        def ensure_start_time_is_given(func):  # pylint: disable=no-self-argument
            """
            Ensures that the starting time is given before launching the decorated
            method.

            :raise PyFunceble.cli.continuous_integration.exceptions.StartTimeNotFound:
                When the token is not found.
            """

            @functools.wraps(func)
            def wrapper(self, *args, **kwargs):
                if not self.start_time:
                    # pylint: disable=line-too-long
                    raise PyFunceble.cli.continuous_integration.exceptions.StartTimeNotFound()

                return func(self, *args, **kwargs)  # pylint: disable=not-callable

            return wrapper

        @property
        def authorized(self) -> Optional[bool]:
            """
            Provides the currently state of the :code:`_authorized` attribute.
            """

            return self._authorized

        @authorized.setter
        def authorized(self, value: bool) -> None:
            """
            Sets the value of the :code:`authorized` attribute.

            :param value:
                The value to set.

            :raise TypeError:
                When the given :code:`value` is not a :py:class:`bool`
            """

            if not isinstance(value, bool):
                raise TypeError(f"<value> should be {bool}, {type(value)} given.")

            self._authorized = value

        @property
        def bypass_bypass(self) -> bool:
            """
            Provides the currently state of the :code:`_bypass_bypass` attribute.
            """

            return (
                EnvironmentVariableHelper("PYFUNCEBLE_BYPASS_BYPASS").get_value()
                is not None
            )

        def set_authorized(self, value: bool) -> "ContinuousIntegrationBase":
            """
            Sets the value of the :code:`authorized` attribute.

            :param value:
                The value to set.
            """

            self.authorized = value

            return self

        @property
        def git_email(self) -> Optional[str]:
            """
            Provides the currently state of the :code:`_git_email` attribute.
            """

            return self._git_email

        @git_email.setter
        def git_email(self, value: str) -> None:
            """
            Sets the Git Email to use.

            :param value:
                The value to set.

            :raise TypeError:
                When the given :code:`value` is not a :py:class:`str`.
            :raise valueError:
                When the given :code:`value` is empty.
            """

            if not isinstance(value, str):
                raise TypeError(f"<value> should be {str}, {type(value)} given.")

            if not value:
                raise ValueError("<value> should not be empty.")

            self._git_email = value

        def set_git_email(self, value: str) -> "ContinuousIntegrationBase":
            """
            Sets the Git Email to use.

            :param value:
                The value to set.
            """

            self.git_email = value

            return self

        @property
        def git_name(self) -> Optional[str]:
            """
            Provides the current state of the :code:`_git_name` attribute.
            """

            return self._git_name

        @git_name.setter
        def git_name(self, value: str) -> None:
            """
            Sets the Git Name to use.

            :param value:
                The value to set.

            :raise TypeError:
                When the given :code:`value` is not a :py:class:`str`.
            :raise valueError:
                When the given :code:`value` is empty.
            """

            if not isinstance(value, str):
                raise TypeError(f"<value> should be {str}, {type(value)} given.")

            if not value:
                raise ValueError("<value> should not be empty.")

            self._git_name = value

        def set_git_name(self, value: str) -> "ContinuousIntegrationBase":
            """
            Sets the Git Name to use.

            :param value:
                The value to set.
            """

            self.git_name = value

            return self

        @property
        def git_branch(self) -> Optional[str]:
            """
            Provides the current state of the :code:`_git_branch` attribute.
            """

            return self._git_branch

        @git_branch.setter
        def git_branch(self, value: str) -> None:
            """
            Sets the Git Branch to use.

            :param value:
                The value to set.

            :raise TypeError:
                When the given :code:`value` is not a :py:class:`str`.
            :raise valueError:
                When the given :code:`value` is empty.
            """

            if not isinstance(value, str):
                raise TypeError(f"<value> should be {str}, {type(value)} given.")

            if not value:
                raise ValueError("<value> should not be empty.")

            self._git_branch = value

        def set_git_branch(self, value: str) -> "ContinuousIntegrationBase":
            """
            Sets the Git Branch to use.

            :param value:
                The value to set.
            """

            self.git_branch = value

            return self

        @property
        def git_distribution_branch(self) -> Optional[str]:
            """
            Provides the current state of the :code:`_git_distribution_branch`
            attribute.
            """

            return self._git_distribution_branch

        @git_distribution_branch.setter
        def git_distribution_branch(self, value: str) -> None:
            """
            Sets the Git distribution Branch to use.

            :param value:
                The value to set.

            :raise TypeError:
                When the given :code:`value` is not a :py:class:`str`.
            :raise valueError:
                When the given :code:`value` is empty.
            """

            if not isinstance(value, str):
                raise TypeError(f"<value> should be {str}, {type(value)} given.")

            if not value:
                raise ValueError("<value> should not be empty.")

            self._git_distribution_branch = value

        def set_git_distribution_branch(self, value: str) -> "ContinuousIntegrationBase":
            """
            Sets the Git distribution Branch to use.

            :param value:
                The value to set.
            """

            self.git_distribution_branch = value

            return self

        @property
        def token(self) -> Optional[str]:
            """
            Provides the current state of the :code:`_token` attribute.
            """

            return self._token

        @token.setter
        def token(self, value: str) -> None:
            """
            Sets the token to use.

            :param value:
                The value to set.

            :raise TypeError:
                When the given :code:`value` is not a :py:class:`str`.
            :raise valueError:
                When the given :code:`value` is empty.
            """

            if not isinstance(value, str):
                raise TypeError(f"<value> should be {str}, {type(value)} given.")

            if not value:
                raise ValueError("<value> should not be empty.")

            self._token = value

        def set_token(self, value: str) -> "ContinuousIntegrationBase":
            """
            Sets the token to use.

            :param value:
                The value to set.
            """

            self.token = value

            return value

        @property
        def command(self) -> Optional[str]:
            """
            Provides the current state of the :code:`_command` attribute.
            """

            return self._command

        @command.setter
        def command(self, value: str) -> None:
            """
            Sets the command to work with.

            :param value:
                The command to set.

            :raise TypeError:
                When the given :code:`value` is not a :py:class:`str`.
            :raise ValueError:
                When the given :code:`value` is empty.
            """

            if not isinstance(value, str):
                raise TypeError(f"<value> should be {str}, {type(value)} given.")

            if not value:
                raise ValueError("<value> should not be empty.")

            self._command = value

        def set_command(self, value: str) -> "ContinuousIntegrationBase":
            """
            Sets the command to work with.

            :param value:
                The command to set.
            """

            self.command = value

            return self

        @property
        def end_command(self) -> Optional[str]:
            """
            Provides the current state of the :code:`_end_command` attribute.
            """

            return self._end_command

        @end_command.setter
        def end_command(self, value: str) -> None:
            """
            Sets the command to execute at the really end of the process with.

            :param value:
                The command to set.

            :raise TypeError:
                When the given :code:`value` is not a :py:class:`str`.
            :raise ValueError:
                When the given :code:`value` is empty.
            """

            if not isinstance(value, str):
                raise TypeError(f"<value> should be {str}, {type(value)} given.")

            if not value:
                raise ValueError("<value> should not be empty.")

            self._end_command = value

        def set_end_command(self, value: str) -> "ContinuousIntegrationBase":
            """
            Sets the command to execute at the really end of the process with.

            :param value:
                The command to set.
            """

            self.end_command = value

            return self

        @property
        def commit_message(self) -> Optional[str]:
            """
            Provides the current state of the :code:`_commit_message` attribute.
            """

            return self._commit_message

        @commit_message.setter
        def commit_message(self, value: str) -> None:
            """
            Sets the commit message to apply to all commits except the final one.

            :param value:
                The message to set.

            :raise TypeError:
                When the given :code:`value` is not a :py:class:`str`.
            :raise ValueError:
                When the given :code:`value` is empty.
            """

            if not isinstance(value, str):
                raise TypeError(f"<value> should be {str}, {type(value)} given.")

            if not value:
                raise ValueError("<value> should not be empty.")

            self._commit_message = value

        def set_commit_message(self, value: str) -> "ContinuousIntegrationBase":
            """
            Sets the commit message to apply to all commits except the final one.

            :param value:
                The message to set.
            """

            self.commit_message = value

            return self

        @property
        def end_commit_message(self) -> Optional[str]:
            """
            Provides the current state of the :code:`_end_commit_message` attribute.
            """

            return self._end_commit_message

        @end_commit_message.setter
        def end_commit_message(self, value: str) -> None:
            """
            Sets the commit message to apply to the final one.

            :param value:
                The message to set.

            :raise TypeError:
                When the given :code:`value` is not a :py:class:`str`.
            :raise ValueError:
                When the given :code:`value` is empty.
            """

            if not isinstance(value, str):
                raise TypeError(f"<value> should be {str}, {type(value)} given.")

            if not value:
                raise ValueError("<value> should not be empty.")

            self._end_commit_message = value

        def set_end_commit_message(self, value: str) -> "ContinuousIntegrationBase":
            """
            Sets the commit message to apply to the final one.

            :param value:
                The command to set.
            """

            self.end_commit_message = value

            return self

        @property
        def max_exec_minutes(self) -> Optional[str]:
            """
            Provides the current state of the :code:`_max_exec_minutes` attribute.
            """

            return self._max_exec_minutes

        @max_exec_minutes.setter
        def max_exec_minutes(self, value: str) -> None:
            """
            Sets the maximum waiting time before considering the time as exceeded.

            :param value:
                The message to set.

            :raise TypeError:
                When the given :code:`value` is not a :py:class:`int`.
            :raise ValueError:
                When the given :code:`value` is less than :code:`1`.
            """

            if not isinstance(value, int):
                raise TypeError(f"<value> should be {int}, {type(value)} given.")

            if value < 1:
                raise ValueError("<value> should be greater or equal to 1.")

            self._max_exec_minutes = value

        def set_max_exec_minutes(self, value: str) -> "ContinuousIntegrationBase":
            """
            Sets the maximum waiting time before considering the time as exceeded.

            :param value:
                The command to set.
            """

            self._max_exec_minutes = value

            return self

        @execute_if_authorized(None)
        def set_start_time(self) -> "ContinuousIntegrationBase":
            """
            Sets the starting time to now.
            """

            self.start_time = datetime.datetime.now(datetime.timezone.utc)
            self.expected_end_time = self.start_time + datetime.timedelta(
                minutes=self.max_exec_minutes
            )

        @staticmethod
        def get_remote_destination():
            """
            Provides the remote destination to use.

            :raise PyFunceble.cli.continuous_integration.exceptions.RemoteURLNotFound:
                When we could not determine the remote destination.
            """

            regex = r"(?:[a-z]+(?:\s+|\t+))(.*)(?:(?:\s+|\t+)\([a-z]+\))"
            remote_of_interest = [
                x
                for x in CommandHelper("git remote -v").execute().splitlines()
                if "(fetch)" in x
            ][0]

            filtered = RegexHelper(regex).match(
                remote_of_interest, return_match=True, group=1
            )

            if filtered:
                if "@" in filtered:
                    return filtered[filtered.find("@") + 1 :]
                if "//" in filtered:
                    return filtered[filtered.find("//") + 2 :]

            raise PyFunceble.cli.continuous_integration.exceptions.RemoteURLNotFound()

        @staticmethod
        def exec_command(command: str, allow_stdout: bool) -> None:
            """
            Executes the given command.

            :param command:
                The command to execute.

            :param allow_stdout:
                Allows us to return the command output to stdout.
            """

            PyFunceble.facility.Logger.debug("Executing %r", command)

            command_helper = CommandHelper(command)

            if allow_stdout:
                command_helper.run_to_stdout()
            else:
                command_helper.execute()

        def guess_and_set_authorized(self) -> "ContinuousIntegrationBase":
            """
            Tries to guess the authorization.
            """

            if PyFunceble.facility.ConfigLoader.is_already_loaded():
                self.authorized = bool(
                    PyFunceble.storage.CONFIGURATION.cli_testing.ci.active
                )
            else:
                self.authorized = self.STD_AUTHORIZED

            return self

        def guess_and_set_git_email(self) -> "ContinuousIntegrationBase":
            """
            Tries to guess and set the Git Email.
            """

            environment_var = EnvironmentVariableHelper("GIT_EMAIL")

            if environment_var.exists():
                self.git_email = environment_var.get_value()

            return self

        def guess_and_set_git_name(self) -> "ContinuousIntegrationBase":
            """
            Tries to guess and set the Git Name.
            """

            environment_var = EnvironmentVariableHelper("GIT_NAME")

            if environment_var.exists():
                self.git_name = environment_var.get_value()

            return self

        def guess_and_set_git_branch(self) -> "ContinuousIntegrationBase":
            """
            Tries to guess and set the Git Branch.
            """

            environment_var = EnvironmentVariableHelper("GIT_BRANCH")

            if environment_var.exists():
                self.git_branch = environment_var.get_value()
            elif PyFunceble.facility.ConfigLoader.is_already_loaded():
                self.git_branch = PyFunceble.storage.CONFIGURATION.cli_testing.ci.branch
            else:
                self.git_branch = self.STD_GIT_BRANCH

            return self

        def guess_and_set_git_distribution_branch(self) -> "ContinuousIntegrationBase":
            """
            Tries to guess and set the Git distribution Branch.
            """

            environment_var = EnvironmentVariableHelper("GIT_DISTRIBUTION_BRANCH")

            if environment_var.exists():
                self.git_distribution_branch = environment_var.get_value()
            elif PyFunceble.facility.ConfigLoader.is_already_loaded():
                self.git_distribution_branch = (
                    PyFunceble.storage.CONFIGURATION.cli_testing.ci.distribution_branch
                )
            else:
                self.git_distribution_branch = self.STD_GIT_DISTRIBUTION_BRANCH

            return self

        def guess_and_set_token(self) -> "ContinuousIntegrationBase":
            """
            Tries to guess and set the token.
            """

            raise NotImplementedError()

        def guess_and_set_command(self) -> "ContinuousIntegrationBase":
            """
            Tries to guess and set the command to execute.
            """

            if PyFunceble.facility.ConfigLoader.is_already_loaded():
                if PyFunceble.storage.CONFIGURATION.cli_testing.ci.command:
                    self.command = PyFunceble.storage.CONFIGURATION.cli_testing.ci.command

            return self

        def guess_and_set_end_command(self) -> "ContinuousIntegrationBase":
            """
            Tries to guess and set the command to execute at the very end.
            """

            if PyFunceble.facility.ConfigLoader.is_already_loaded():
                if PyFunceble.storage.CONFIGURATION.cli_testing.ci.end_command:
                    self.end_command = (
                        PyFunceble.storage.CONFIGURATION.cli_testing.ci.end_command
                    )

            return self

        def guess_and_set_commit_message(self) -> "ContinuousIntegrationBase":
            """
            Tries to guess and set the commit message to apply.
            """

            if PyFunceble.facility.ConfigLoader.is_already_loaded():
                if PyFunceble.storage.CONFIGURATION.cli_testing.ci.commit_message:
                    self.commit_message = (
                        PyFunceble.storage.CONFIGURATION.cli_testing.ci.commit_message
                    )
                else:
                    self.commit_message = self.STD_COMMIT_MESSAGE
            else:
                self.commit_message = self.STD_COMMIT_MESSAGE

            return self

        def guess_and_set_end_commit_message(self) -> "ContinuousIntegrationBase":
            """
            Tries to guess and set the commit message to apply at the very end.
            """

            if PyFunceble.facility.ConfigLoader.is_already_loaded():
                if PyFunceble.storage.CONFIGURATION.cli_testing.ci.end_commit_message:
                    self.end_commit_message = (
                        PyFunceble.storage.CONFIGURATION.cli_testing.ci.end_commit_message
                    )
                else:
                    self.end_commit_message = self.STD_END_COMMIT_MESSAGE
            else:
                self.end_commit_message = self.STD_END_COMMIT_MESSAGE

            return self

        def guess_and_set_max_exec_minutes(self) -> "ContinuousIntegrationBase":
            """
            Tries to guess and set the maximum execution time.
            """

            if PyFunceble.facility.ConfigLoader.is_already_loaded():
                self.max_exec_minutes = (
                    PyFunceble.storage.CONFIGURATION.cli_testing.ci.max_exec_minutes
                )
            else:
                self.max_exec_minutes = self.STD_MAX_EXEC_MINUTES

            return self

        def guess_all_settings(self) -> "ContinuousIntegrationBase":
            """
            Try to guess all settings.
            """

            to_ignore = ["guess_all_settings"]

            for method in dir(self):
                if method in to_ignore or not method.startswith("guess_"):
                    continue

                getattr(self, method)()

            return self

        def is_authorized(self) -> bool:
            """
            Checks if the current object is authorized to run.
            """

            return self.authorized is True

        @execute_if_authorized(False)
        @ensure_start_time_is_given
        def is_time_exceeded(self) -> bool:
            """
            Checks if we exceeded the allocated time we have.
            """

            return self.expected_end_time < datetime.datetime.now(datetime.timezone.utc)

        @execute_if_authorized(None)
        @ensure_token_is_given
        def init_git_remote_with_token(self) -> "ContinuousIntegrationBase":
            """
            Initiates the git remote URL with the help of the given token.
            """

            remote = self.get_remote_destination()

            # Each entries should have a tuple containing the command to run and
            # if we are authorized to print to STDOUT.
            commands_to_execute = [
                ("git remote rm origin", False),
                ("git remote add origin " f"https://{self.token}@{remote}", False),
                ("git remote update", False),
                ("git fetch", False),
            ]

            for command, allow_stdout in commands_to_execute:
                self.exec_command(command, allow_stdout)

            return self

        @execute_if_authorized(None)
        @ensure_git_name_is_given
        @ensure_git_email_is_given
        @ensure_git_branch_is_given
        @ensure_git_distribution_branch_is_given
        def init_git(self) -> "ContinuousIntegrationBase":
            """
            Initiate the git repository.
            """

            PyFunceble.facility.Logger.info("Started initialization of GIT.")

            if self.token:
                self.init_git_remote_with_token()

            commands = [
                (f'git config --local user.email "{self.git_email}"', False),
                (f'git config --local user.name "{self.git_name}"', False),
                ("git config --local push.default simple", False),
                ("git config --local pull.rebase true", False),
                ("git config --local core.autocrlf true", False),
                ("git config --local branch.autosetuprebase always", False),
                (f'git checkout "{self.git_branch}"', False),
                ("git fetch origin", False),
                (
                    f"git rebase -X theirs " f"origin/{self.git_distribution_branch}",
                    False,
                ),
            ]

            for command, allow_stdout in commands:
                self.exec_command(command, allow_stdout)

            self.git_initialized = True

            PyFunceble.facility.Logger.info("Finished initialization of GIT.")

            return self

        def fix_permissions(self) -> "ContinuousIntegrationBase":
            """
            A method to overwrite when custom rules for permissions are needed.

            .. note::
                This method is automatically called by the methods who apply
                commits.
            """

            return self

        @execute_if_authorized(None)
        def push_changes(self, branch: str, *, exit_it: bool = True) -> None:
            """
            Pushes the changes.

            :param branch:
                The branch to push.

            :param exit_it:
                Exits after the push ?

            :raise PyFunceble.cli.continuous_integration.exceptions.StopExecution:
                When the :code:`exit_it` is set to :code:`True`.
            """

            PyFunceble.facility.Logger.info("Started to push GIT changes.")

            commands = []

            if self.git_initialized:
                commands.extend(
                    [
                        (
                            f'git checkout "{branch}"',
                            True,
                        ),
                        ("git fetch origin", True),
                        (f"git rebase -X theirs origin/{branch}", True),
                        (f"git push origin {branch}", True),
                    ]
                )

            for command, allow_stdout in commands:
                self.exec_command(command, allow_stdout)

            PyFunceble.facility.Logger.info("Finished to push GIT changes.")

            if exit_it:
                raise PyFunceble.cli.continuous_integration.exceptions.StopExecution()

        @execute_if_authorized(None)
        def apply_end_commit(self, *, push: bool = True) -> None:
            """
            Apply the "end" commit and push.

            Side effect:
                It runs the declared command to execute.

            :param push:
                Whether we should push the changes or not.
            """

            PyFunceble.facility.Logger.info(
                "Started to prepare and apply final GIT commit."
            )

            self.fix_permissions()

            commands = []

            if self.git_distribution_branch != self.git_branch:
                branch_to_use = self.git_distribution_branch
            else:
                branch_to_use = self.git_branch

            if self.end_command:
                commands.append((self.end_command, True))

            if self.git_initialized:
                commands.extend(
                    [
                        ("git fetch origin", True),
                        (
                            f"git rebase -X theirs origin/{branch_to_use}",
                            True,
                        ),
                        ("git add --all", True),
                        (
                            "git commit -a -m "
                            f'"{self.end_commit_message} {self.end_commit_marker}\n\n'
                            f'{secrets.token_urlsafe(18)}"',
                            True,
                        ),
                    ]
                )

            for command, allow_stdout in commands:
                self.exec_command(command, allow_stdout)

            if self.end_command:
                # Fix permissions because we met some strange behaviors in the past.
                self.fix_permissions()

            PyFunceble.facility.Logger.info(
                "Finished to prepare and apply final GIT commit."
            )

            if push:
                self.push_changes(branch_to_use)

        @execute_if_authorized(None)
        def apply_commit(self, *, push: bool = True) -> None:
            """
            Apply the commit and push.

            Side effect:
                It runs the declared command to execute.

            :param push:
                Whether we should push the changes or not.
            """

            PyFunceble.facility.Logger.info("Started to prepare and apply GIT commit.")

            self.fix_permissions()

            commands = []

            if self.command:
                commands.append((self.command, True))

            if self.git_initialized:
                commands.extend(
                    [
                        ("git add --all", True),
                        (
                            "git commit -a -m "
                            f'"{self.commit_message}\n\n'
                            f'{secrets.token_urlsafe(18)}"',
                            True,
                        ),
                    ]
                )

            for command, allow_stdout in commands:
                self.exec_command(command, allow_stdout)

            if self.command:
                # Fix permissions because we met some strange behaviors in the past.
                self.fix_permissions()

            PyFunceble.facility.Logger.info("Finished to prepare and apply GIT commit.")

            if push:
                self.push_changes(self.git_branch)

        @execute_if_authorized(None)
        def bypass(self) -> None:
            """
            Stops everything if the latest commit message match any of those:

                - :code:`[PyFunceble skip]` (case insensitive)
                - :code:`[PyFunceble-skip]` (case insensitive)
                - :code:`[skip-PyFunceble]` (case insensitive)
                - :code:`[skip PyFunceble]` (case insensitive)
                - :attr:`~PyFunceble.cli.continuous_integration.base.end_commit_marker`
                - :attr:`~PyFunceble.cli.continuous_integration.base.COMMON_CI_SKIP_MARKER`
            """

            our_marker = self.COMMON_CI_SKIP_MARKER + [
                "[pyfunceble skip]",
                "[pyfunceble-skip]",
                "[skip-pyfunceble]",
                "[skip pyfunceble]",
                self.end_commit_marker,
            ]
            latest_commit = CommandHelper("git log -1").execute().lower()

            if not self.bypass_bypass and any(
                x.lower() in latest_commit for x in our_marker
            ):
                PyFunceble.facility.Logger.info(
                    "Bypass marker caught. Saving and stopping process."
                )

                raise PyFunceble.cli.continuous_integration.exceptions.StopExecution()

        @execute_if_authorized(None)
        def init(self) -> "ContinuousIntegrationBase":
            """
            Initiate our infrastructure for the current CI engine.

            The purpose of this method is to be able to have some custom init based
            on the CI we are currently on.

            The init method should be manually started before running any further
            action.

            .. warning::
                We assume that we are aware that you should run this method first.
            """

            PyFunceble.facility.Logger.info("Started initialization of workflow.")

            self.init_git()

            PyFunceble.facility.Logger.info("Finished initialization of workflow.")

            return self

### `authorized` `property` `writable`

Provides the currently state of the :code:`_authorized` attribute.

### `bypass_bypass` `property`

Provides the currently state of the :code:`_bypass_bypass` attribute.

### `command` `property` `writable`

Provides the current state of the :code:`_command` attribute.

### `commit_message` `property` `writable`

Provides the current state of the :code:`_commit_message` attribute.

### `end_command` `property` `writable`

Provides the current state of the :code:`_end_command` attribute.

### `end_commit_message` `property` `writable`

Provides the current state of the :code:`_end_commit_message` attribute.

### `git_branch` `property` `writable`

Provides the current state of the :code:`_git_branch` attribute.

### `git_distribution_branch` `property` `writable`

Provides the current state of the :code:`_git_distribution_branch` attribute.

### `git_email` `property` `writable`

Provides the currently state of the :code:`_git_email` attribute.

### `git_name` `property` `writable`

Provides the current state of the :code:`_git_name` attribute.

### `max_exec_minutes` `property` `writable`

Provides the current state of the :code:`_max_exec_minutes` attribute.

### `token` `property` `writable`

Provides the current state of the :code:`_token` attribute.

### `apply_commit(*, push=True)`

Apply the commit and push.

Side effect: It runs the declared command to execute.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`push` | `bool` | Whether we should push the changes or not. | `True`

Source code in `PyFunceble/cli/continuous_integration/base.py`

    1211
    1212
    1213
    1214
    1215
    1216
    1217
    1218
    1219
    1220
    1221
    1222
    1223
    1224
    1225
    1226
    1227
    1228
    1229
    1230
    1231
    1232
    1233
    1234
    1235
    1236
    1237
    1238
    1239
    1240
    1241
    1242
    1243
    1244
    1245
    1246
    1247
    1248
    1249
    1250
    1251
    1252
    1253
    1254
    1255

    @execute_if_authorized(None)
    def apply_commit(self, *, push: bool = True) -> None:
        """
        Apply the commit and push.

        Side effect:
            It runs the declared command to execute.

        :param push:
            Whether we should push the changes or not.
        """

        PyFunceble.facility.Logger.info("Started to prepare and apply GIT commit.")

        self.fix_permissions()

        commands = []

        if self.command:
            commands.append((self.command, True))

        if self.git_initialized:
            commands.extend(
                [
                    ("git add --all", True),
                    (
                        "git commit -a -m "
                        f'"{self.commit_message}\n\n'
                        f'{secrets.token_urlsafe(18)}"',
                        True,
                    ),
                ]
            )

        for command, allow_stdout in commands:
            self.exec_command(command, allow_stdout)

        if self.command:
            # Fix permissions because we met some strange behaviors in the past.
            self.fix_permissions()

        PyFunceble.facility.Logger.info("Finished to prepare and apply GIT commit.")

        if push:
            self.push_changes(self.git_branch)

### `apply_end_commit(*, push=True)`

Apply the "end" commit and push.

Side effect: It runs the declared command to execute.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`push` | `bool` | Whether we should push the changes or not. | `True`

Source code in `PyFunceble/cli/continuous_integration/base.py`

    1151
    1152
    1153
    1154
    1155
    1156
    1157
    1158
    1159
    1160
    1161
    1162
    1163
    1164
    1165
    1166
    1167
    1168
    1169
    1170
    1171
    1172
    1173
    1174
    1175
    1176
    1177
    1178
    1179
    1180
    1181
    1182
    1183
    1184
    1185
    1186
    1187
    1188
    1189
    1190
    1191
    1192
    1193
    1194
    1195
    1196
    1197
    1198
    1199
    1200
    1201
    1202
    1203
    1204
    1205
    1206
    1207
    1208
    1209

    @execute_if_authorized(None)
    def apply_end_commit(self, *, push: bool = True) -> None:
        """
        Apply the "end" commit and push.

        Side effect:
            It runs the declared command to execute.

        :param push:
            Whether we should push the changes or not.
        """

        PyFunceble.facility.Logger.info(
            "Started to prepare and apply final GIT commit."
        )

        self.fix_permissions()

        commands = []

        if self.git_distribution_branch != self.git_branch:
            branch_to_use = self.git_distribution_branch
        else:
            branch_to_use = self.git_branch

        if self.end_command:
            commands.append((self.end_command, True))

        if self.git_initialized:
            commands.extend(
                [
                    ("git fetch origin", True),
                    (
                        f"git rebase -X theirs origin/{branch_to_use}",
                        True,
                    ),
                    ("git add --all", True),
                    (
                        "git commit -a -m "
                        f'"{self.end_commit_message} {self.end_commit_marker}\n\n'
                        f'{secrets.token_urlsafe(18)}"',
                        True,
                    ),
                ]
            )

        for command, allow_stdout in commands:
            self.exec_command(command, allow_stdout)

        if self.end_command:
            # Fix permissions because we met some strange behaviors in the past.
            self.fix_permissions()

        PyFunceble.facility.Logger.info(
            "Finished to prepare and apply final GIT commit."
        )

        if push:
            self.push_changes(branch_to_use)

### `bypass()`

Stops everything if the latest commit message match any of those:

    - :code:`[PyFunceble skip]` (case insensitive)
    - :code:`[PyFunceble-skip]` (case insensitive)
    - :code:`[skip-PyFunceble]` (case insensitive)
    - :code:`[skip PyFunceble]` (case insensitive)
    - :attr:`~PyFunceble.cli.continuous_integration.base.end_commit_marker`
    - :attr:`~PyFunceble.cli.continuous_integration.base.COMMON_CI_SKIP_MARKER`

Source code in `PyFunceble/cli/continuous_integration/base.py`

    1257
    1258
    1259
    1260
    1261
    1262
    1263
    1264
    1265
    1266
    1267
    1268
    1269
    1270
    1271
    1272
    1273
    1274
    1275
    1276
    1277
    1278
    1279
    1280
    1281
    1282
    1283
    1284
    1285
    1286

    @execute_if_authorized(None)
    def bypass(self) -> None:
        """
        Stops everything if the latest commit message match any of those:

            - :code:`[PyFunceble skip]` (case insensitive)
            - :code:`[PyFunceble-skip]` (case insensitive)
            - :code:`[skip-PyFunceble]` (case insensitive)
            - :code:`[skip PyFunceble]` (case insensitive)
            - :attr:`~PyFunceble.cli.continuous_integration.base.end_commit_marker`
            - :attr:`~PyFunceble.cli.continuous_integration.base.COMMON_CI_SKIP_MARKER`
        """

        our_marker = self.COMMON_CI_SKIP_MARKER + [
            "[pyfunceble skip]",
            "[pyfunceble-skip]",
            "[skip-pyfunceble]",
            "[skip pyfunceble]",
            self.end_commit_marker,
        ]
        latest_commit = CommandHelper("git log -1").execute().lower()

        if not self.bypass_bypass and any(
            x.lower() in latest_commit for x in our_marker
        ):
            PyFunceble.facility.Logger.info(
                "Bypass marker caught. Saving and stopping process."
            )

            raise PyFunceble.cli.continuous_integration.exceptions.StopExecution()

### `ensure_git_branch_is_given(func)`

Ensures that the Git Branch is given before launching the decorated method.

Raises:

Type | Description
--- | ---
`PyFunceble.cli.continuous_integration.exceptions.GitBranchNotFound` | When the Git Branch is not found.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269

    def ensure_git_branch_is_given(func):  # pylint: disable=no-self-argument
        """
        Ensures that the Git Branch is given before launching the decorated
        method.

        :raise PyFunceble.cli.continuous_integration.exceptions.GitBranchNotFound:
            When the Git Branch is not found.
        """

        @functools.wraps(func)
        def wrapper(self, *args, **kwargs):
            if not self.git_name:
                raise PyFunceble.cli.continuous_integration.exceptions.GitNameNotFound()

            return func(self, *args, **kwargs)  # pylint: disable=not-callable

        return wrapper

### `ensure_git_distribution_branch_is_given(func)`

Ensures that the Git distribution Branch is given before launching the decorated method.

Raises:

Type | Description
--- | ---
`PyFunceble.cli.continuous_integration.exceptions.GitDistributionBranchNotFound` | When the Git distribution Branch is not found.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289

    def ensure_git_distribution_branch_is_given(
        func,
    ):  # pylint: disable=no-self-argument,line-too-long
        """
        Ensures that the Git distribution Branch is given before launching the
        decorated method.

        :raise PyFunceble.cli.continuous_integration.exceptions.GitDistributionBranchNotFound:
            When the Git distribution Branch is not found.
        """

        @functools.wraps(func)
        def wrapper(self, *args, **kwargs):
            if not self.git_name:
                raise PyFunceble.cli.continuous_integration.exceptions.GitNameNotFound()

            return func(self, *args, **kwargs)  # pylint: disable=not-callable

        return wrapper

### `ensure_git_email_is_given(func)`

Ensures that the Git Email is given before launching the decorated method.

Raises:

Type | Description
--- | ---
`PyFunceble.cli.continuous_integration.exceptions.GitEmailNotFound` | When the Git Email is not found.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233

    def ensure_git_email_is_given(func):  # pylint: disable=no-self-argument
        """
        Ensures that the Git Email is given before launching the decorated
        method.

        :raise PyFunceble.cli.continuous_integration.exceptions.GitEmailNotFound:
            When the Git Email is not found.
        """

        @functools.wraps(func)
        def wrapper(self, *args, **kwargs):
            if not self.git_email:
                # pylint: disable=line-too-long
                raise PyFunceble.cli.continuous_integration.exceptions.GitEmailNotFound()

            return func(self, *args, **kwargs)  # pylint: disable=not-callable

        return wrapper

### `ensure_git_name_is_given(func)`

Ensures that the Git Name is given before launching the decorated method.

Raises:

Type | Description
--- | ---
`PyFunceble.cli.continuous_integration.exceptions.GitNameNotFound` | When the Git Name is not found.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251

    def ensure_git_name_is_given(func):  # pylint: disable=no-self-argument
        """
        Ensures that the Git Name is given before launching the decorated
        method.

        :raise PyFunceble.cli.continuous_integration.exceptions.GitNameNotFound:
            When the Git Name is not found.
        """

        @functools.wraps(func)
        def wrapper(self, *args, **kwargs):
            if not self.git_name:
                raise PyFunceble.cli.continuous_integration.exceptions.GitNameNotFound()

            return func(self, *args, **kwargs)  # pylint: disable=not-callable

        return wrapper

### `ensure_start_time_is_given(func)`

Ensures that the starting time is given before launching the decorated method.

Raises:

Type | Description
--- | ---
`PyFunceble.cli.continuous_integration.exceptions.StartTimeNotFound` | When the token is not found.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325

    def ensure_start_time_is_given(func):  # pylint: disable=no-self-argument
        """
        Ensures that the starting time is given before launching the decorated
        method.

        :raise PyFunceble.cli.continuous_integration.exceptions.StartTimeNotFound:
            When the token is not found.
        """

        @functools.wraps(func)
        def wrapper(self, *args, **kwargs):
            if not self.start_time:
                # pylint: disable=line-too-long
                raise PyFunceble.cli.continuous_integration.exceptions.StartTimeNotFound()

            return func(self, *args, **kwargs)  # pylint: disable=not-callable

        return wrapper

### `ensure_token_is_given(func)`

Ensures that the token is given before launching the decorated method.

Raises:

Type | Description
--- | ---
`PyFunceble.cli.continuous_integration.exceptions.TokenNotFound` | When the token is not found.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306

    def ensure_token_is_given(func):  # pylint: disable=no-self-argument
        """
        Ensures that the token is given before launching the decorated method.

        :raise PyFunceble.cli.continuous_integration.exceptions.TokenNotFound:
            When the token is not found.
        """

        @functools.wraps(func)
        def wrapper(self, *args, **kwargs):
            if not self.token:
                raise PyFunceble.cli.continuous_integration.exceptions.TokenNotFound()

            return func(self, *args, **kwargs)  # pylint: disable=not-callable

        return wrapper

### `exec_command(command, allow_stdout)` `staticmethod`

Executes the given command.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`command` | `str` | The command to execute. | required
`allow_stdout` | `bool` | Allows us to return the command output to stdout. | required

Source code in `PyFunceble/cli/continuous_integration/base.py`

    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854

    @staticmethod
    def exec_command(command: str, allow_stdout: bool) -> None:
        """
        Executes the given command.

        :param command:
            The command to execute.

        :param allow_stdout:
            Allows us to return the command output to stdout.
        """

        PyFunceble.facility.Logger.debug("Executing %r", command)

        command_helper = CommandHelper(command)

        if allow_stdout:
            command_helper.run_to_stdout()
        else:
            command_helper.execute()

### `execute_if_authorized(default=None)`

Executes the decorated method only if we are authorized to process. Otherwise, apply the given :code:`default`.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214

    def execute_if_authorized(default: Any = None):  # pylint: disable=no-self-argument
        """
        Executes the decorated method only if we are authorized to process.
        Otherwise, apply the given :code:`default`.
        """

        def inner_method(func):
            @functools.wraps(func)
            def wrapper(self, *args, **kwargs):
                if self.authorized:
                    return func(self, *args, **kwargs)  # pylint: disable=not-callable
                return self if default is None else default

            return wrapper

        return inner_method

### `fix_permissions()`

A method to overwrite when custom rules for permissions are needed.

.. note:: This method is automatically called by the methods who apply commits.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    1100
    1101
    1102
    1103
    1104
    1105
    1106
    1107
    1108
    1109

    def fix_permissions(self) -> "ContinuousIntegrationBase":
        """
        A method to overwrite when custom rules for permissions are needed.

        .. note::
            This method is automatically called by the methods who apply
            commits.
        """

        return self

### `get_remote_destination()` `staticmethod`

Provides the remote destination to use.

Raises:

Type | Description
--- | ---
`PyFunceble.cli.continuous_integration.exceptions.RemoteURLNotFound` | When we could not determine the remote destination.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833

    @staticmethod
    def get_remote_destination():
        """
        Provides the remote destination to use.

        :raise PyFunceble.cli.continuous_integration.exceptions.RemoteURLNotFound:
            When we could not determine the remote destination.
        """

        regex = r"(?:[a-z]+(?:\s+|\t+))(.*)(?:(?:\s+|\t+)\([a-z]+\))"
        remote_of_interest = [
            x
            for x in CommandHelper("git remote -v").execute().splitlines()
            if "(fetch)" in x
        ][0]

        filtered = RegexHelper(regex).match(
            remote_of_interest, return_match=True, group=1
        )

        if filtered:
            if "@" in filtered:
                return filtered[filtered.find("@") + 1 :]
            if "//" in filtered:
                return filtered[filtered.find("//") + 2 :]

        raise PyFunceble.cli.continuous_integration.exceptions.RemoteURLNotFound()

### `guess_all_settings()`

Try to guess all settings.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    1007
    1008
    1009
    1010
    1011
    1012
    1013
    1014
    1015
    1016
    1017
    1018
    1019
    1020

    def guess_all_settings(self) -> "ContinuousIntegrationBase":
        """
        Try to guess all settings.
        """

        to_ignore = ["guess_all_settings"]

        for method in dir(self):
            if method in to_ignore or not method.startswith("guess_"):
                continue

            getattr(self, method)()

        return self

### `guess_and_set_authorized()`

Tries to guess the authorization.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868

    def guess_and_set_authorized(self) -> "ContinuousIntegrationBase":
        """
        Tries to guess the authorization.
        """

        if PyFunceble.facility.ConfigLoader.is_already_loaded():
            self.authorized = bool(
                PyFunceble.storage.CONFIGURATION.cli_testing.ci.active
            )
        else:
            self.authorized = self.STD_AUTHORIZED

        return self

### `guess_and_set_command()`

Tries to guess and set the command to execute.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    935
    936
    937
    938
    939
    940
    941
    942
    943
    944

    def guess_and_set_command(self) -> "ContinuousIntegrationBase":
        """
        Tries to guess and set the command to execute.
        """

        if PyFunceble.facility.ConfigLoader.is_already_loaded():
            if PyFunceble.storage.CONFIGURATION.cli_testing.ci.command:
                self.command = PyFunceble.storage.CONFIGURATION.cli_testing.ci.command

        return self

### `guess_and_set_commit_message()`

Tries to guess and set the commit message to apply.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    969
    970
    971
    972
    973
    974

    def guess_and_set_commit_message(self) -> "ContinuousIntegrationBase":
        """
        Tries to guess and set the commit message to apply.
        """

        if PyFunceble.facility.ConfigLoader.is_already_loaded():
            if PyFunceble.storage.CONFIGURATION.cli_testing.ci.commit_message:
                self.commit_message = (
                    PyFunceble.storage.CONFIGURATION.cli_testing.ci.commit_message
                )
            else:
                self.commit_message = self.STD_COMMIT_MESSAGE
        else:
            self.commit_message = self.STD_COMMIT_MESSAGE

        return self

### `guess_and_set_end_command()`

Tries to guess and set the command to execute at the very end.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    946
    947
    948
    949
    950
    951
    952
    953
    954
    955
    956
    957

    def guess_and_set_end_command(self) -> "ContinuousIntegrationBase":
        """
        Tries to guess and set the command to execute at the very end.
        """

        if PyFunceble.facility.ConfigLoader.is_already_loaded():
            if PyFunceble.storage.CONFIGURATION.cli_testing.ci.end_command:
                self.end_command = (
                    PyFunceble.storage.CONFIGURATION.cli_testing.ci.end_command
                )

        return self

### `guess_and_set_end_commit_message()`

Tries to guess and set the commit message to apply at the very end.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    976
    977
    978
    979
    980
    981
    982
    983
    984
    985
    986
    987
    988
    989
    990
    991

    def guess_and_set_end_commit_message(self) -> "ContinuousIntegrationBase":
        """
        Tries to guess and set the commit message to apply at the very end.
        """

        if PyFunceble.facility.ConfigLoader.is_already_loaded():
            if PyFunceble.storage.CONFIGURATION.cli_testing.ci.end_commit_message:
                self.end_commit_message = (
                    PyFunceble.storage.CONFIGURATION.cli_testing.ci.end_commit_message
                )
            else:
                self.end_commit_message = self.STD_END_COMMIT_MESSAGE
        else:
            self.end_commit_message = self.STD_END_COMMIT_MESSAGE

        return self

### `guess_and_set_git_branch()`

Tries to guess and set the Git Branch.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908

    def guess_and_set_git_branch(self) -> "ContinuousIntegrationBase":
        """
        Tries to guess and set the Git Branch.
        """

        environment_var = EnvironmentVariableHelper("GIT_BRANCH")

        if environment_var.exists():
            self.git_branch = environment_var.get_value()
        elif PyFunceble.facility.ConfigLoader.is_already_loaded():
            self.git_branch = PyFunceble.storage.CONFIGURATION.cli_testing.ci.branch
        else:
            self.git_branch = self.STD_GIT_BRANCH

        return self

### `guess_and_set_git_distribution_branch()`

Tries to guess and set the Git distribution Branch.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    910
    911
    912
    913
    914
    915
    916
    917
    918
    919
    920
    921
    922
    923
    924
    925
    926

    def guess_and_set_git_distribution_branch(self) -> "ContinuousIntegrationBase":
        """
        Tries to guess and set the Git distribution Branch.
        """

        environment_var = EnvironmentVariableHelper("GIT_DISTRIBUTION_BRANCH")

        if environment_var.exists():
            self.git_distribution_branch = environment_var.get_value()
        elif PyFunceble.facility.ConfigLoader.is_already_loaded():
            self.git_distribution_branch = (
                PyFunceble.storage.CONFIGURATION.cli_testing.ci.distribution_branch
            )
        else:
            self.git_distribution_branch = self.STD_GIT_DISTRIBUTION_BRANCH

        return self

### `guess_and_set_git_email()`

Tries to guess and set the Git Email.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880

    def guess_and_set_git_email(self) -> "ContinuousIntegrationBase":
        """
        Tries to guess and set the Git Email.
        """

        environment_var = EnvironmentVariableHelper("GIT_EMAIL")

        if environment_var.exists():
            self.git_email = environment_var.get_value()

        return self

### `guess_and_set_git_name()`

Tries to guess and set the Git Name.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892

    def guess_and_set_git_name(self) -> "ContinuousIntegrationBase":
        """
        Tries to guess and set the Git Name.
        """

        environment_var = EnvironmentVariableHelper("GIT_NAME")

        if environment_var.exists():
            self.git_name = environment_var.get_value()

        return self

### `guess_and_set_max_exec_minutes()`

Tries to guess and set the maximum execution time.

Source code in `PyFunceble/cli/continuous_integration/base.py`

     993
     994
     995
     996
     997
     998
     999
    1000
    1001
    1002
    1003
    1004
    1005

    def guess_and_set_max_exec_minutes(self) -> "ContinuousIntegrationBase":
        """
        Tries to guess and set the maximum execution time.
        """

        if PyFunceble.facility.ConfigLoader.is_already_loaded():
            self.max_exec_minutes = (
                PyFunceble.storage.CONFIGURATION.cli_testing.ci.max_exec_minutes
            )
        else:
            self.max_exec_minutes = self.STD_MAX_EXEC_MINUTES

        return self

### `guess_and_set_token()`

Tries to guess and set the token.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    928
    929
    930
    931
    932
    933

    def guess_and_set_token(self) -> "ContinuousIntegrationBase":
        """
        Tries to guess and set the token.
        """

        raise NotImplementedError()

### `init()`

Initiate our infrastructure for the current CI engine.

The purpose of this method is to be able to have some custom init based on the CI we are currently on.

The init method should be manually started before running any further action.

.. warning:: We assume that we are aware that you should run this method first.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    1288
    1289
    1290
    1291
    1292
    1293
    1294
    1295
    1296
    1297
    1298
    1299
    1300
    1301
    1302
    1303
    1304
    1305
    1306
    1307
    1308
    1309

    @execute_if_authorized(None)
    def init(self) -> "ContinuousIntegrationBase":
        """
        Initiate our infrastructure for the current CI engine.

        The purpose of this method is to be able to have some custom init based
        on the CI we are currently on.

        The init method should be manually started before running any further
        action.

        .. warning::
            We assume that we are aware that you should run this method first.
        """

        PyFunceble.facility.Logger.info("Started initialization of workflow.")

        self.init_git()

        PyFunceble.facility.Logger.info("Finished initialization of workflow.")

        return self

### `init_git()`

Initiate the git repository.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    1061
    1062
    1063
    1064
    1065
    1066
    1067
    1068
    1069
    1070
    1071
    1072
    1073
    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    1084
    1085
    1086
    1087
    1088
    1089
    1090
    1091
    1092
    1093
    1094
    1095
    1096
    1097
    1098

    @execute_if_authorized(None)
    @ensure_git_name_is_given
    @ensure_git_email_is_given
    @ensure_git_branch_is_given
    @ensure_git_distribution_branch_is_given
    def init_git(self) -> "ContinuousIntegrationBase":
        """
        Initiate the git repository.
        """

        PyFunceble.facility.Logger.info("Started initialization of GIT.")

        if self.token:
            self.init_git_remote_with_token()

        commands = [
            (f'git config --local user.email "{self.git_email}"', False),
            (f'git config --local user.name "{self.git_name}"', False),
            ("git config --local push.default simple", False),
            ("git config --local pull.rebase true", False),
            ("git config --local core.autocrlf true", False),
            ("git config --local branch.autosetuprebase always", False),
            (f'git checkout "{self.git_branch}"', False),
            ("git fetch origin", False),
            (
                f"git rebase -X theirs " f"origin/{self.git_distribution_branch}",
                False,
            ),
        ]

        for command, allow_stdout in commands:
            self.exec_command(command, allow_stdout)

        self.git_initialized = True

        PyFunceble.facility.Logger.info("Finished initialization of GIT.")

        return self

### `init_git_remote_with_token()`

Initiates the git remote URL with the help of the given token.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    1057
    1058
    1059

    @execute_if_authorized(None)
    @ensure_token_is_given
    def init_git_remote_with_token(self) -> "ContinuousIntegrationBase":
        """
        Initiates the git remote URL with the help of the given token.
        """

        remote = self.get_remote_destination()

        # Each entries should have a tuple containing the command to run and
        # if we are authorized to print to STDOUT.
        commands_to_execute = [
            ("git remote rm origin", False),
            ("git remote add origin " f"https://{self.token}@{remote}", False),
            ("git remote update", False),
            ("git fetch", False),
        ]

        for command, allow_stdout in commands_to_execute:
            self.exec_command(command, allow_stdout)

        return self

### `is_authorized()`

Checks if the current object is authorized to run.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    1022
    1023
    1024
    1025
    1026
    1027

    def is_authorized(self) -> bool:
        """
        Checks if the current object is authorized to run.
        """

        return self.authorized is True

### `is_time_exceeded()`

Checks if we exceeded the allocated time we have.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    1029
    1030
    1031
    1032
    1033
    1034
    1035
    1036

    @execute_if_authorized(False)
    @ensure_start_time_is_given
    def is_time_exceeded(self) -> bool:
        """
        Checks if we exceeded the allocated time we have.
        """

        return self.expected_end_time < datetime.datetime.now(datetime.timezone.utc)

### `push_changes(branch, *, exit_it=True)`

Pushes the changes.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`branch` | `str` | The branch to push. | required
`exit_it` | `bool` | Exits after the push ? | `True`

Raises:

Type | Description
--- | ---
`PyFunceble.cli.continuous_integration.exceptions.StopExecution` | When the :code:`exit_it` is set to :code:`True`.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    1111
    1112
    1113
    1114
    1115
    1116
    1117
    1118
    1119
    1120
    1121
    1122
    1123
    1124
    1125
    1126
    1127
    1128
    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136
    1137
    1138
    1139
    1140
    1141
    1142
    1143
    1144
    1145
    1146
    1147
    1148
    1149

    @execute_if_authorized(None)
    def push_changes(self, branch: str, *, exit_it: bool = True) -> None:
        """
        Pushes the changes.

        :param branch:
            The branch to push.

        :param exit_it:
            Exits after the push ?

        :raise PyFunceble.cli.continuous_integration.exceptions.StopExecution:
            When the :code:`exit_it` is set to :code:`True`.
        """

        PyFunceble.facility.Logger.info("Started to push GIT changes.")

        commands = []

        if self.git_initialized:
            commands.extend(
                [
                    (
                        f'git checkout "{branch}"',
                        True,
                    ),
                    ("git fetch origin", True),
                    (f"git rebase -X theirs origin/{branch}", True),
                    (f"git push origin {branch}", True),
                ]
            )

        for command, allow_stdout in commands:
            self.exec_command(command, allow_stdout)

        PyFunceble.facility.Logger.info("Finished to push GIT changes.")

        if exit_it:
            raise PyFunceble.cli.continuous_integration.exceptions.StopExecution()

### `set_authorized(value)`

Sets the value of the :code:`authorized` attribute.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`value` | `bool` | The value to set. | required

Source code in `PyFunceble/cli/continuous_integration/base.py`

    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373

    def set_authorized(self, value: bool) -> "ContinuousIntegrationBase":
        """
        Sets the value of the :code:`authorized` attribute.

        :param value:
            The value to set.
        """

        self.authorized = value

        return self

### `set_command(value)`

Sets the command to work with.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`value` | `str` | The command to set. | required

Source code in `PyFunceble/cli/continuous_integration/base.py`

    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626

    def set_command(self, value: str) -> "ContinuousIntegrationBase":
        """
        Sets the command to work with.

        :param value:
            The command to set.
        """

        self.command = value

        return self

### `set_commit_message(value)`

Sets the commit message to apply to all commits except the final one.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`value` | `str` | The message to set. | required

Source code in `PyFunceble/cli/continuous_integration/base.py`

    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710

    def set_commit_message(self, value: str) -> "ContinuousIntegrationBase":
        """
        Sets the commit message to apply to all commits except the final one.

        :param value:
            The message to set.
        """

        self.commit_message = value

        return self

### `set_end_command(value)`

Sets the command to execute at the really end of the process with.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`value` | `str` | The command to set. | required

Source code in `PyFunceble/cli/continuous_integration/base.py`

    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668

    def set_end_command(self, value: str) -> "ContinuousIntegrationBase":
        """
        Sets the command to execute at the really end of the process with.

        :param value:
            The command to set.
        """

        self.end_command = value

        return self

### `set_end_commit_message(value)`

Sets the commit message to apply to the final one.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`value` | `str` | The command to set. | required

Source code in `PyFunceble/cli/continuous_integration/base.py`

    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752

    def set_end_commit_message(self, value: str) -> "ContinuousIntegrationBase":
        """
        Sets the commit message to apply to the final one.

        :param value:
            The command to set.
        """

        self.end_commit_message = value

        return self

### `set_git_branch(value)`

Sets the Git Branch to use.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`value` | `str` | The value to set. | required

Source code in `PyFunceble/cli/continuous_integration/base.py`

    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499

    def set_git_branch(self, value: str) -> "ContinuousIntegrationBase":
        """
        Sets the Git Branch to use.

        :param value:
            The value to set.
        """

        self.git_branch = value

        return self

### `set_git_distribution_branch(value)`

Sets the Git distribution Branch to use.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`value` | `str` | The value to set. | required

Source code in `PyFunceble/cli/continuous_integration/base.py`

    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542

    def set_git_distribution_branch(self, value: str) -> "ContinuousIntegrationBase":
        """
        Sets the Git distribution Branch to use.

        :param value:
            The value to set.
        """

        self.git_distribution_branch = value

        return self

### `set_git_email(value)`

Sets the Git Email to use.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`value` | `str` | The value to set. | required

Source code in `PyFunceble/cli/continuous_integration/base.py`

    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415

    def set_git_email(self, value: str) -> "ContinuousIntegrationBase":
        """
        Sets the Git Email to use.

        :param value:
            The value to set.
        """

        self.git_email = value

        return self

### `set_git_name(value)`

Sets the Git Name to use.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`value` | `str` | The value to set. | required

Source code in `PyFunceble/cli/continuous_integration/base.py`

    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457

    def set_git_name(self, value: str) -> "ContinuousIntegrationBase":
        """
        Sets the Git Name to use.

        :param value:
            The value to set.
        """

        self.git_name = value

        return self

### `set_max_exec_minutes(value)`

Sets the maximum waiting time before considering the time as exceeded.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`value` | `str` | The command to set. | required

Source code in `PyFunceble/cli/continuous_integration/base.py`

    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794

    def set_max_exec_minutes(self, value: str) -> "ContinuousIntegrationBase":
        """
        Sets the maximum waiting time before considering the time as exceeded.

        :param value:
            The command to set.
        """

        self._max_exec_minutes = value

        return self

### `set_start_time()`

Sets the starting time to now.

Source code in `PyFunceble/cli/continuous_integration/base.py`

    796
    797
    798
    799
    800
    801
    802
    803
    804
    805

    @execute_if_authorized(None)
    def set_start_time(self) -> "ContinuousIntegrationBase":
        """
        Sets the starting time to now.
        """

        self.start_time = datetime.datetime.now(datetime.timezone.utc)
        self.expected_end_time = self.start_time + datetime.timedelta(
            minutes=self.max_exec_minutes
        )

### `set_token(value)`

Sets the token to use.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`value` | `str` | The value to set. | required

Source code in `PyFunceble/cli/continuous_integration/base.py`

    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584

    def set_token(self, value: str) -> "ContinuousIntegrationBase":
        """
        Sets the token to use.

        :param value:
            The value to set.
        """

        self.token = value

        return value